Ejemplo n.º 1
0
        private void GenerateVS2017ProjectFile(string serviceFilesRoot, ServiceConfiguration serviceConfiguration, ProjectFileConfiguration projectFileConfiguration)
        {
            var assemblyName = "AWSSDK." + serviceConfiguration.Namespace.Split('.')[1];
            var projectType  = projectFileConfiguration.Name;

            var projectProperties = new Project();

            projectProperties.AssemblyName      = assemblyName;
            projectProperties.ProjectReferences = projectFileConfiguration.ProjectReferences;
            projectProperties.TargetFrameworks  = projectFileConfiguration.TargetFrameworkVersions;
            projectProperties.DefineConstants   = projectFileConfiguration.CompilationConstants;
            projectProperties.CompileRemoveList = projectFileConfiguration.PlatformExcludeFolders.ToList();
            if (serviceConfiguration.IsTestService)
            {
                var toExclude = projectProperties.CompileRemoveList as List <string>;
                toExclude.Add("UnitTests");
            }
            projectProperties.FrameworkPathOverride                = projectFileConfiguration.FrameworkPathOverride;
            projectProperties.ReferenceDependencies                = projectFileConfiguration.DllReferences;
            projectProperties.SupressWarnings                      = projectFileConfiguration.NoWarn;
            projectProperties.SignBinaries                         = true;
            projectProperties.PackageReferences                    = projectFileConfiguration.PackageReferences;
            projectProperties.FxcopAnalyzerRuleSetFilePath         = @"..\..\..\AWSDotNetSDK.ruleset";
            projectProperties.FxcopAnalyzerRuleSetFilePathForBuild = @"..\..\..\AWSDotNetSDKForBuild.ruleset";
            projectProperties.CustomRoslynAnalyzersDllDirectory    = @"..\..\..\..\buildtools\CustomRoslynAnalyzers.dll";

            List <Dependency>       dependencies;
            List <PackageReference> references = new List <PackageReference>();

            if (serviceConfiguration.NugetDependencies != null &&
                serviceConfiguration.NugetDependencies.TryGetValue(projectFileConfiguration.Name, out dependencies))
            {
                foreach (var dependency in dependencies)
                {
                    references.Add(new PackageReference
                    {
                        Include = dependency.Name,
                        Version = dependency.Version,
                    });
                }

                projectProperties.PackageReferences = references;
            }

            var projectJsonTemplate = new VS2017ProjectFile();

            projectJsonTemplate.Project = projectProperties;

            var content = projectJsonTemplate.TransformText();

            GeneratorDriver.WriteFile(serviceFilesRoot, string.Empty, string.Format("{0}.{1}.csproj", assemblyName, projectType), content);
        }
Ejemplo n.º 2
0
        private void GenerateVS2017ProjectFile(string serviceFilesRoot, ServiceConfiguration serviceConfiguration, ProjectFileConfiguration projectFileConfiguration)
        {
            var serviceName  = serviceConfiguration.Namespace.Split('.')[1];
            var assemblyName = "AWSSDK." + serviceName;
            var projectType  = projectFileConfiguration.Name;

            var templateSession = new Dictionary <string, object>();

            templateSession["AssemblyName"]          = assemblyName;
            templateSession["ProjectReferenceList"]  = projectFileConfiguration.ProjectReferences;
            templateSession["TargetFramework"]       = projectFileConfiguration.TargetFrameworkVersion;
            templateSession["DefineConstants"]       = projectFileConfiguration.CompilationConstants;
            templateSession["CompileRemoveList"]     = projectFileConfiguration.PlatformExcludeFolders;
            templateSession["FrameworkPathOverride"] = projectFileConfiguration.FrameworkPathOverride;
            templateSession["ReferencePath"]         = projectFileConfiguration.ReferencePath;
            templateSession["FrameworkReferences"]   = projectFileConfiguration.FrameworkReferences;
            templateSession["NoWarn"]            = projectFileConfiguration.NoWarn;
            templateSession["SignBinaries"]      = true;
            templateSession["ConfigurationName"] = projectFileConfiguration.TargetFrameworkVersion;
            templateSession["PathMapValue"]      = Path.Combine(@"aws-sdk-net\sdk\src\Services\", serviceName);

            List <Dependency>       dependencies;
            List <PackageReference> references = new List <PackageReference>();

            if (serviceConfiguration.NugetDependencies != null &&
                serviceConfiguration.NugetDependencies.TryGetValue(projectFileConfiguration.Name, out dependencies))
            {
                foreach (var dependency in dependencies)
                {
                    references.Add(new PackageReference
                    {
                        Include = dependency.Name,
                        Version = dependency.Version,
                    });
                }

                templateSession["PackageReferenceList"] = references;
            }

            var projectJsonTemplate = new VS2017ProjectFile();

            projectJsonTemplate.Session = templateSession;

            var content = projectJsonTemplate.TransformText();

            GeneratorDriver.WriteFile(serviceFilesRoot, string.Empty, string.Format("{0}.{1}.csproj", assemblyName, projectType), content);
        }
Ejemplo n.º 3
0
        private void GenerateVS2017ProjectFile(string serviceFilesRoot, ServiceConfiguration serviceConfiguration, ProjectFileConfiguration projectFileConfiguration)
        {
            var assemblyName = "AWSSDK." + serviceConfiguration.Namespace.Split('.')[1];
            var projectType  = projectFileConfiguration.Name;

            var projectProperties = new Project();

            projectProperties.AssemblyName          = assemblyName;
            projectProperties.ProjectReferences     = projectFileConfiguration.ProjectReferences;
            projectProperties.TargetFrameworks      = projectFileConfiguration.TargetFrameworkVersions;
            projectProperties.DefineConstants       = projectFileConfiguration.CompilationConstants;
            projectProperties.CompileRemoveList     = projectFileConfiguration.PlatformExcludeFolders;
            projectProperties.FrameworkPathOverride = projectFileConfiguration.FrameworkPathOverride;
            projectProperties.ReferenceDependencies = projectFileConfiguration.DllReferences;
            projectProperties.SupressWarnings       = projectFileConfiguration.NoWarn;
            projectProperties.SignBinaries          = true;

            List <Dependency>       dependencies;
            List <PackageReference> references = new List <PackageReference>();

            if (serviceConfiguration.NugetDependencies != null &&
                serviceConfiguration.NugetDependencies.TryGetValue(projectFileConfiguration.Name, out dependencies))
            {
                foreach (var dependency in dependencies)
                {
                    references.Add(new PackageReference
                    {
                        Include = dependency.Name,
                        Version = dependency.Version,
                    });
                }

                projectProperties.PackageReferences = references;
            }

            var projectJsonTemplate = new VS2017ProjectFile();

            projectJsonTemplate.Project = projectProperties;

            var content = projectJsonTemplate.TransformText();

            GeneratorDriver.WriteFile(serviceFilesRoot, string.Empty, string.Format("{0}.{1}.csproj", assemblyName, projectType), content);
        }