当前位置: 首页>>代码示例>>C#>>正文


C# Microsoft.Build类代码示例

本文整理汇总了C#中Microsoft.Build的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.Build类的具体用法?C# Microsoft.Build怎么用?C# Microsoft.Build使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Microsoft.Build类属于命名空间,在下文中一共展示了Microsoft.Build类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: VisualBasicProjectFile

 public VisualBasicProjectFile(VisualBasicProjectFileLoader loader, MSB.Evaluation.Project loadedProject, IMetadataService metadataService, IAnalyzerService analyzerService) : base(loader, loadedProject)
 {
     _metadataService = metadataService;
     _analyzerService = analyzerService;
     _hostBuildDataFactory = loader.LanguageServices.GetService<IHostBuildDataFactory>();
     _commandLineArgumentsFactory = loader.LanguageServices.GetService<ICommandLineArgumentsFactoryService>();
 }
开发者ID:daking2014,项目名称:roslyn,代码行数:7,代码来源:VisualBasicProjectFileLoader.cs

示例2: CSharpProjectFile

 public CSharpProjectFile(CSharpProjectFileLoader loader, MSB.Evaluation.Project project, IMetadataService metadataService, IAnalyzerService analyzerService)
     : base(loader, project)
 {
     _metadataService = metadataService;
     _analyzerService = analyzerService;
     _msbuildHost = loader.MSBuildHost;
     _commandLineArgumentsFactoryService = loader.CommandLineArgumentsFactoryService;
 }
开发者ID:GloryChou,项目名称:roslyn,代码行数:8,代码来源:CSharpProjectFileLoader.CSharpProjectFile.cs

示例3: LoadProjectInstance

		internal static ProjectInstance LoadProjectInstance(MSBuild.Evaluation.ProjectCollection projectCollection, ProjectRootElement rootElement, IDictionary<string, string> globalProps)
		{
			lock (SolutionProjectCollectionLock) {
				string toolsVersion = rootElement.ToolsVersion;
				if (string.IsNullOrEmpty(toolsVersion))
					toolsVersion = projectCollection.DefaultToolsVersion;
				return new ProjectInstance(rootElement, globalProps, toolsVersion, projectCollection);
			}
		}
开发者ID:rbrunhuber,项目名称:SharpDevelop,代码行数:9,代码来源:MSBuildInternals.cs

示例4: GetLocationFromCondition

 internal static PropertyStorageLocations GetLocationFromCondition(MSBuild.Construction.ProjectElement element)
 {
     while (element != null) {
         if (!string.IsNullOrEmpty(element.Condition))
             return GetLocationFromCondition(element.Condition);
         element = element.Parent;
     }
     return PropertyStorageLocations.Base;
 }
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:9,代码来源:MSBuildInternals.cs

示例5: BuildTargets

 public BuildTargets(MSB.Evaluation.Project project, params string[] targets)
 {
     this.project = project;
     this.buildTargets = new List<string>();
     this.buildTargets.AddRange(targets);
 }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:6,代码来源:BuildTargets.cs

示例6: CreateProjectFileInfo

            private ProjectFileInfo CreateProjectFileInfo(CSharpCompilerInputs compilerInputs, MSB.Execution.ProjectInstance executedProject)
            {
                string projectDirectory = executedProject.Directory;
                if (!projectDirectory.EndsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.OrdinalIgnoreCase))
                {
                    projectDirectory += Path.DirectorySeparatorChar;
                }

                var docs = compilerInputs.Sources
                       .Where(s => !Path.GetFileName(s.ItemSpec).StartsWith("TemporaryGeneratedFile_"))
                       .Select(s => MakeDocumentFileInfo(projectDirectory, s))
                       .ToImmutableArray();

                IEnumerable<MetadataReference> metadataRefs;
                IEnumerable<AnalyzerReference> analyzerRefs;
                this.GetReferences(compilerInputs, executedProject, out metadataRefs, out analyzerRefs);

                var outputPath = Path.Combine(this.GetOutputDirectory(), compilerInputs.OutputFileName);
                var assemblyName = this.GetAssemblyName();

                return new ProjectFileInfo(
                    this.Guid,
                    outputPath,
                    assemblyName,
                    compilerInputs.CompilationOptions,
                    compilerInputs.ParseOptions,
                    docs,
                    this.GetProjectReferences(executedProject),
                    metadataRefs,
                    analyzerRefs);
            }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:31,代码来源:CSharpProjectFileLoader.CSharpProjectFile.cs

示例7: CreateProjectFileInfo

            private ProjectFileInfo CreateProjectFileInfo(CSharpCompilerInputs compilerInputs, MSB.Execution.ProjectInstance executedProject)
            {
                string projectDirectory = executedProject.Directory;
                string directorySeparator = Path.DirectorySeparatorChar.ToString();
                if (!projectDirectory.EndsWith(directorySeparator, StringComparison.OrdinalIgnoreCase))
                {
                    projectDirectory += directorySeparator;
                }

                var docs = compilerInputs.Sources
                       .Where(s => !Path.GetFileName(s.ItemSpec).StartsWith("TemporaryGeneratedFile_", StringComparison.Ordinal))
                       .Select(s => MakeDocumentFileInfo(projectDirectory, s))
                       .ToImmutableArray();

                var additionalDocs = compilerInputs.AdditionalSources
                        .Select(s => MakeDocumentFileInfo(projectDirectory, s))
                        .ToImmutableArray();

                var outputPath = Path.Combine(this.GetOutputDirectory(), compilerInputs.OutputFileName);
                var assemblyName = this.GetAssemblyName();

                return new ProjectFileInfo(
                    outputPath,
                    assemblyName,
                    compilerInputs.CommandLineArgs,
                    docs,
                    additionalDocs,
                    this.GetProjectReferences(executedProject));
            }
开发者ID:RoryVL,项目名称:roslyn,代码行数:29,代码来源:CSharpProjectFileLoader.CSharpProjectFile.cs

示例8: CreateProjectFileInfo

            private ProjectFileInfo CreateProjectFileInfo(CSharpCompilerInputs compilerInputs, MSB.Execution.ProjectInstance executedProject)
            {
                string projectDirectory = executedProject.Directory;
                if (!projectDirectory.EndsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.OrdinalIgnoreCase))
                {
                    projectDirectory += Path.DirectorySeparatorChar;
                }

                var docs = compilerInputs.Sources
                       .Where(s => !Path.GetFileName(s.ItemSpec).StartsWith("TemporaryGeneratedFile_"))
                       .Select(s => MakeDocumentFileInfo(projectDirectory, s))
                       .ToImmutableList();

                var metadataRefs = compilerInputs.References.SelectMany(r => MakeMetadataInfo(r));

                var analyzerRefs = compilerInputs.AnalyzerReferences.Select(r => new AnalyzerFileReference(GetDocumentFilePath(r)));

                if (!compilerInputs.NoStandardLib)
                {
                    var mscorlibPath = typeof(object).Assembly.Location;
                    metadataRefs = metadataRefs.Concat(new[] { new MetadataInfo(mscorlibPath) });
                }

                return new ProjectFileInfo(
                    this.Guid,
                    this.GetTargetPath(),
                    this.GetAssemblyName(),
                    compilerInputs.CompilationOptions,
                    compilerInputs.ParseOptions,
                    docs,
                    this.GetProjectReferences(executedProject),
                    metadataRefs,
                    analyzerRefs,
                    appConfigPath: compilerInputs.AppConfigPath);
            }
开发者ID:riversky,项目名称:roslyn,代码行数:35,代码来源:CSharpProjectFileLoader.CSharpProjectFile.cs

示例9: InitializeFromModel

            private void InitializeFromModel(CSharpCompilerInputs compilerInputs, MSB.Execution.ProjectInstance executedProject)
            {
                compilerInputs.BeginInitialization();

                compilerInputs.SetAllowUnsafeBlocks(this.ReadPropertyBool(executedProject, "AllowUnsafeBlocks"));
                compilerInputs.SetApplicationConfiguration(this.ReadPropertyString(executedProject, "AppConfigForCompiler"));
                compilerInputs.SetBaseAddress(this.ReadPropertyString(executedProject, "BaseAddress"));
                compilerInputs.SetCheckForOverflowUnderflow(this.ReadPropertyBool(executedProject, "CheckForOverflowUnderflow"));
                compilerInputs.SetCodePage(this.ReadPropertyInt(executedProject, "CodePage"));
                compilerInputs.SetDebugType(this.ReadPropertyString(executedProject, "DebugType"));
                compilerInputs.SetDefineConstants(this.ReadPropertyString(executedProject, "DefineConstants"));

                var delaySignProperty = this.GetProperty("DelaySign");
                compilerInputs.SetDelaySign(delaySignProperty != null && !string.IsNullOrEmpty(delaySignProperty.EvaluatedValue), this.ReadPropertyBool(executedProject, "DelaySign"));

                compilerInputs.SetDisabledWarnings(this.ReadPropertyString(executedProject, "NoWarn"));
                compilerInputs.SetDocumentationFile(this.GetItemString(executedProject, "DocFileItem"));
                compilerInputs.SetEmitDebugInformation(this.ReadPropertyBool(executedProject, "DebugSymbols"));
                compilerInputs.SetErrorReport(this.ReadPropertyString(executedProject, "ErrorReport"));
                compilerInputs.SetFileAlignment(this.ReadPropertyInt(executedProject, "FileAlignment"));
                compilerInputs.SetGenerateFullPaths(this.ReadPropertyBool(executedProject, "GenerateFullPaths"));
                compilerInputs.SetHighEntropyVA(this.ReadPropertyBool(executedProject, "HighEntropyVA"));

                bool signAssembly = this.ReadPropertyBool(executedProject, "SignAssembly");
                if (signAssembly)
                {
                    compilerInputs.SetKeyContainer(this.ReadPropertyString(executedProject, "KeyContainerName"));
                    compilerInputs.SetKeyFile(this.ReadPropertyString(executedProject, "KeyOriginatorFile", "AssemblyOriginatorKeyFile"));
                }

                compilerInputs.SetLangVersion(this.ReadPropertyString(executedProject, "LangVersion"));

                compilerInputs.SetMainEntryPoint(null, this.ReadPropertyString(executedProject, "StartupObject"));
                compilerInputs.SetModuleAssemblyName(this.ReadPropertyString(executedProject, "ModuleAssemblyName"));
                compilerInputs.SetNoStandardLib(this.ReadPropertyBool(executedProject, "NoCompilerStandardLib"));
                compilerInputs.SetOptimize(this.ReadPropertyBool(executedProject, "Optimize"));
                compilerInputs.SetOutputAssembly(this.GetItemString(executedProject, "IntermediateAssembly"));
                compilerInputs.SetPdbFile(this.ReadPropertyString(executedProject, "PdbFile"));

                if (this.ReadPropertyBool(executedProject, "Prefer32Bit"))
                {
                    compilerInputs.SetPlatformWith32BitPreference(this.ReadPropertyString(executedProject, "PlatformTarget"));
                }
                else
                {
                    compilerInputs.SetPlatform(this.ReadPropertyString(executedProject, "PlatformTarget"));
                }

                compilerInputs.SetSubsystemVersion(this.ReadPropertyString(executedProject, "SubsystemVersion"));
                compilerInputs.SetTargetType(this.ReadPropertyString(executedProject, "OutputType"));

                // Decode the warning options from RuleSet file prior to reading explicit settings in the project file, so that project file settings prevail for duplicates.
                compilerInputs.SetRuleSet(this.ReadPropertyString(executedProject, "RuleSet"));
                compilerInputs.SetTreatWarningsAsErrors(this.ReadPropertyBool(executedProject, "TreatWarningsAsErrors"));
                compilerInputs.SetWarningLevel(this.ReadPropertyInt(executedProject, "WarningLevel"));
                compilerInputs.SetWarningsAsErrors(this.ReadPropertyString(executedProject, "WarningsAsErrors"));
                compilerInputs.SetWarningsNotAsErrors(this.ReadPropertyString(executedProject, "WarningsNotAsErrors"));

                compilerInputs.SetReferences(this.GetMetadataReferencesFromModel(executedProject).ToArray());
                compilerInputs.SetAnalyzers(this.GetAnalyzerReferencesFromModel(executedProject).ToArray());
                compilerInputs.SetSources(this.GetDocumentsFromModel(executedProject).ToArray());

                string errorMessage;
                int errorCode;
                compilerInputs.EndInitialization(out errorMessage, out errorCode);
            }
开发者ID:riversky,项目名称:roslyn,代码行数:66,代码来源:CSharpProjectFileLoader.CSharpProjectFile.cs

示例10: GetAliases

            private ImmutableArray<string> GetAliases(MSB.Framework.ITaskItem item)
            {
                var aliasesText = item.GetMetadata("Aliases");

                if (string.IsNullOrEmpty(aliasesText))
                {
                    return ImmutableArray<string>.Empty;
                }

                return ImmutableArray.CreateRange(aliasesText.Split(new char[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries));
            }
开发者ID:riversky,项目名称:roslyn,代码行数:11,代码来源:CSharpProjectFileLoader.CSharpProjectFile.cs

示例11: LoadedProjectInfo

 public LoadedProjectInfo(MSB.Evaluation.Project project, string errorMessage)
 {
     this.Project = project;
     this.ErrorMessage = errorMessage;
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:5,代码来源:ProjectFileLoader.cs

示例12: SetResponseFiles

 public bool SetResponseFiles(MSB.Framework.ITaskItem[] responseFiles)
 {
     // ??
     return true;
 }
开发者ID:riversky,项目名称:roslyn,代码行数:5,代码来源:CSharpProjectFileLoader.CSharpProjectFile.cs

示例13: SetAnalyzers

 public bool SetAnalyzers(MSB.Framework.ITaskItem[] analyzerReferences)
 {
     this.AnalyzerReferences = analyzerReferences ?? SpecializedCollections.EmptyEnumerable<MSB.Framework.ITaskItem>();
     return true;
 }
开发者ID:riversky,项目名称:roslyn,代码行数:5,代码来源:CSharpProjectFileLoader.CSharpProjectFile.cs

示例14: SplitTargets

 private static IEnumerable<string> GetTargetDependents(MSB.Evaluation.Project project, string targetName)
 {
     MSB.Execution.ProjectTargetInstance targetInstance;
     if (project.Targets.TryGetValue(targetName, out targetInstance))
     {
         return SplitTargets(project.ExpandString(targetInstance.DependsOnTargets));
     }
     else
     {
         return SpecializedCollections.EmptyEnumerable<string>();
     }
 }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:12,代码来源:BuildTargets.cs

示例15: GetTopLevelTargets

        internal static IEnumerable<string> GetTopLevelTargets(MSB.Evaluation.Project project)
        {
            // start with set of all targets
            HashSet<string> targets = new HashSet<string>(project.Targets.Keys);

            // remove any target that another target depends on
            foreach (var target in project.Targets.Keys)
            {
                var dependents = GetTargetDependents(project, target).ToList();
                foreach (var depTarget in dependents)
                {
                    targets.Remove(depTarget);
                }
            }

            return targets;
        }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:17,代码来源:BuildTargets.cs


注:本文中的Microsoft.Build类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。