public void WriteRuleSet(ISolutionOptions options)
        {
            string   content     = GenerateCodeAnalysisRuleSet(options.SolutionName);
            string   ruleSetPath = Path.Combine(options.RuleSetDirectory, "SolutionRules.ruleset");
            FileInfo info        = new FileInfo(ruleSetPath);

            if (!info.Directory.Exists)
            {
                info.Directory.Create();
            }
            File.WriteAllText(ruleSetPath, content);
        }
        public void WriteDirectoryBuildProps(ISolutionOptions options)
        {
            string strongNameKeyDirectory = Path.Combine(options.RepositoryDirectory, "build\\strong name keys\\");

            string strongNameKeyFile = Path.Combine(strongNameKeyDirectory, $"{options.SolutionName}SharedKey.snk");

            Directory.CreateDirectory(strongNameKeyDirectory);


            ProjectRootElement root = ProjectRootElement.Create(NewProjectFileOptions.None);

            ProjectPropertyGroupElement p0 = root.AddPropertyGroup();

            p0.AddProperty("MSBuildAllProjects", "$(MSBuildAllProjects);$(MSBuildThisFileFullPath)");

            ProjectPropertyGroupElement p1 = root.AddPropertyGroup();

            p1.AddDefaultProperty("DisableStandardFrameworkResolution", "false");
            p1.AddDefaultProperty("AppendTargetFrameworkToOutputDirectory", "false");

            ProjectPropertyGroupElement p3 = root.AddPropertyGroup();

            p3.AddProperty("SolutionDir", "$(MSBuildThisFileDirectory)");
            p3.AddProperty("RepositoryDirectory", "$([System.IO.Path]::GetFullPath('$(SolutionDir)..\\'))");
            p3.AddDefaultProperty("OutputPath", @"$([System.IO.Path]::GetFullPath('$(RepositoryDirectory)bin\$(Configuration)\$(MSBuildProjectName)\'))");
            p3.AddDefaultProperty("IntermediateOutputPath", @"$([System.IO.Path]::GetFullPath('$(RepositoryDirectory)bin\obj\$(MSBuildProjectName)\$(Configuration)\'))");


            StrongNameKeyInfo           snk = StrongNameKeyManager.GenerateStrongNameKeyInfo();
            ProjectPropertyGroupElement signingProperties = root.AddPropertyGroup();

            signingProperties.AddDefaultProperty("SignAssembly", "true");
            signingProperties.AddDefaultProperty("AssemblyOriginatorKeyFile", "$(RepositoryDirectory)build\\strong name keys\\$(SolutionName)SharedKey.snk");
            signingProperties.AddDefaultProperty("PublicKey", snk.PublicKey);
            signingProperties.AddDefaultProperty("PublicKeyToken", snk.PublicKeyToken);

            File.WriteAllBytes(strongNameKeyFile, snk.RawBytes);

            root.Save(options.DirectoryBuildPropsPath);
        }
        protected override void Execute()
        {
            ISolutionOptions options = DialogService.CreateSolutionViaDialog();

            if (options != null)
            {
                Directory.CreateDirectory(options.RepositoryDirectory);
                Directory.CreateDirectory(options.SolutionDirectory);

                DirectoryBuildPropsWriter.WriteDirectoryBuildProps(options);

                RuleSetWriter.WriteRuleSet(options);

                Solution.CreateSolution(options.SolutionDirectory, options.SolutionName, CreateSolutionFlags.Overwrite);

                Solution.SaveSolutionElement(SaveSolutionOptions.ForceSave, null, 0);

                Solution.OpenSolutionFile(OpenSolutionFlags.Silent, options.SolutionFilePath);

                Project project = Solution2.AddSolutionFolder("Build");
                project.ProjectItems.AddFromFile(options.DirectoryBuildPropsPath);
            }
        }
Esempio n. 4
0
 public SqlBuilder(ISolutionOptions opts)
 {
     _tableTypeBuilder = new SqlTableTypeBuilder();
     _procedureBuilder = new SqlProcedureBuilder(opts);
 }
Esempio n. 5
0
 public SqlProcedureBuilder(ISolutionOptions opts)
 {
     _opts = opts;
 }