• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Construction.ProjectRootElement类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: CreateInMemoryImport

        public async Task CreateInMemoryImport() {
            if (_unloadCancellationToken.IsCancellationRequested) {
                return;
            }

            using (var access = await _projectLockService.WriteLockAsync(_unloadCancellationToken)) {
                // A bit odd but we have to "check it out" prior to creating it to avoid some of the validations in chk CPS
                await access.CheckoutAsync(_inMemoryImportFullPath);

                // Now either open or create the in-memory file. Normally Create will happen, but in
                // a scenario where your project had previously failed to load for some reason, need to TryOpen
                // to avoid a new reason for a project load failure
                _inMemoryImport = ProjectRootElement.TryOpen(_inMemoryImportFullPath, access.ProjectCollection);
                if (_inMemoryImport != null) {
                    // The file already exists. Scrape it out so we don’t add duplicate items.
                    _inMemoryImport.RemoveAllChildren();
                } else {
                    // The project didn’t already exist, so create it, and then mark the evaluated project dirty
                    // so that MSBuild will notice. This step isn’t necessary if the project was already in memory.
                    _inMemoryImport = CreateEmptyMsBuildProject(_inMemoryImportFullPath, access.ProjectCollection);

                    // Note that we actually need to mark every project evaluation dirty that is already loaded.
                    await ReevaluateLoadedConfiguredProjects(_unloadCancellationToken, access);
                }

                _filesItemGroup = _inMemoryImport.AddItemGroup();
                _directoriesItemGroup = _inMemoryImport.AddItemGroup();
                _temporaryAddedItemGroup = _inMemoryImport.AddItemGroup();
            }
        }
开发者ID:Microsoft,项目名称:RTVS,代码行数:30,代码来源:FileSystemMirroringProject.cs


示例2: MSBuildProject

        public MSBuildProject(FilePath filePath)
        {
            FilePath = filePath;

            _msBuildProject = ProjectRootElement.Open(filePath.FullPath, _globalCollection);

            foreach (var item in _msBuildProject.Items)
            {
                if (item.ItemType == "Reference")
                    References.Add(item.Include);
                else if (item.ItemType == "Compile" || item.ItemType == "None")
                {
                    var entry = new ProjectFileEntry(new FilePath(this.ProjectDirectory, item.Include));

                    foreach (var element in item.Metadata)
                    {
                        if (element.Name == "DependentUpon")
                        {
                            entry.Dependencies.Add(element.Value);
                        }
                    }

                    entry.ParentProject = this;
                    AddFileEventHandlers(entry);
                    ProjectFiles.Add(entry);
                }
            }

            SetupEventHandlers();
            HasUnsavedData = false;
        }
开发者ID:ThrDev,项目名称:LiteDevelop,代码行数:31,代码来源:MSBuildProject.cs


示例3: CreateBuildProject

        void CreateBuildProject()
        {
            string projectPath = Path.Combine(buildDirectory, "content.contentproj");
            string outputPath = Path.Combine(buildDirectory, "bin");

            // Create the build project.
            projectRootElement = ProjectRootElement.Create(projectPath);

            // Include the standard targets file that defines how to build XNA Framework content.
            projectRootElement.AddImport(Application.StartupPath + "\\Exporters\\FBX\\XNA\\XNA Game Studio\\" +
                                         "v4.0\\Microsoft.Xna.GameStudio.ContentPipeline.targets");

            buildProject = new Project(projectRootElement);

            buildProject.SetProperty("XnaPlatform", "Windows");
            buildProject.SetProperty("XnaProfile", "Reach");
            buildProject.SetProperty("XnaFrameworkVersion", "v4.0");
            buildProject.SetProperty("Configuration", "Release");
            buildProject.SetProperty("OutputPath", outputPath);
            buildProject.SetProperty("ContentRootDirectory", ".");
            buildProject.SetProperty("ReferencePath", Application.StartupPath);

            // Register any custom importers or processors.
            foreach (string pipelineAssembly in pipelineAssemblies)
            {
                buildProject.AddItem("Reference", pipelineAssembly);
            }

            // Hook up our custom error logger.
            errorLogger = new ErrorLogger();

            buildParameters = new BuildParameters(ProjectCollection.GlobalProjectCollection)
                                  {Loggers = new ILogger[] {errorLogger}};
        }
开发者ID:nicolasmassouh,项目名称:Babylon.js,代码行数:34,代码来源:ContentBuilder.cs


示例4: BuildAsync

    internal static async Task<BuildResult> BuildAsync(this BuildManager buildManager, ITestOutputHelper logger, ProjectCollection projectCollection, ProjectRootElement project, string target, IDictionary<string, string> globalProperties = null, LoggerVerbosity logVerbosity = LoggerVerbosity.Detailed, ILogger[] additionalLoggers = null)
    {
        Requires.NotNull(buildManager, nameof(buildManager));
        Requires.NotNull(projectCollection, nameof(projectCollection));
        Requires.NotNull(project, nameof(project));

        globalProperties = globalProperties ?? new Dictionary<string, string>();
        var projectInstance = new ProjectInstance(project, globalProperties, null, projectCollection);
        var brd = new BuildRequestData(projectInstance, new[] { target }, null, BuildRequestDataFlags.ProvideProjectStateAfterBuild);

        var parameters = new BuildParameters(projectCollection);

        var loggers = new List<ILogger>();
        loggers.Add(new ConsoleLogger(logVerbosity, s => logger.WriteLine(s.TrimEnd('\r', '\n')), null, null));
        loggers.AddRange(additionalLoggers);
        parameters.Loggers = loggers.ToArray();

        buildManager.BeginBuild(parameters);

        var result = await buildManager.BuildAsync(brd);

        buildManager.EndBuild();

        return result;
    }
开发者ID:azeno,项目名称:Nerdbank.GitVersioning,代码行数:25,代码来源:MSBuildExtensions.cs


示例5: BuildIntegrationTests

    public BuildIntegrationTests(ITestOutputHelper logger)
        : base(logger)
    {
        int seed = (int)DateTime.Now.Ticks;
        this.random = new Random(seed);
        this.Logger.WriteLine("Random seed: {0}", seed);
        this.buildManager = new BuildManager();
        this.projectCollection = new ProjectCollection();
        this.projectDirectory = Path.Combine(this.RepoPath, "projdir");
        Directory.CreateDirectory(this.projectDirectory);
        this.LoadTargetsIntoProjectCollection();
        this.testProject = this.CreateProjectRootElement(this.projectDirectory, "test.proj");
        this.testProjectInRoot = this.CreateProjectRootElement(this.RepoPath, "root.proj");
        this.globalProperties.Add("NerdbankGitVersioningTasksPath", Environment.CurrentDirectory + "\\");

        // Sterilize the test of any environment variables.
        foreach (System.Collections.DictionaryEntry variable in Environment.GetEnvironmentVariables())
        {
            string name = (string)variable.Key;
            if (ToxicEnvironmentVariablePrefixes.Any(toxic => name.StartsWith(toxic, StringComparison.OrdinalIgnoreCase)))
            {
                this.globalProperties[name] = string.Empty;
            }
        }
    }
开发者ID:azeno,项目名称:Nerdbank.GitVersioning,代码行数:25,代码来源:BuildIntegrationTests.cs


示例6: ProjectUsingTaskElement

 internal ProjectUsingTaskElement (string taskName, string assemblyFile, string assemblyName,
                                 ProjectRootElement containingProject)
 {
         TaskName = taskName;
         AssemblyFile = assemblyFile;
         AssemblyName = assemblyName;
         ContainingProject = containingProject;
 }
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:ProjectUsingTaskElement.cs


示例7: UpgradeProjectCheck

        protected override ProjectUpgradeState UpgradeProjectCheck(ProjectRootElement projectXml, ProjectRootElement userProjectXml, Action<__VSUL_ERRORLEVEL, string> log, ref Guid projectFactory, ref __VSPPROJECTUPGRADEVIAFACTORYFLAGS backupSupport) {
            var envVarsProp = projectXml.Properties.FirstOrDefault(p => p.Name == NodejsConstants.EnvironmentVariables);
            if (envVarsProp != null && !string.IsNullOrEmpty(envVarsProp.Value)) {
                return ProjectUpgradeState.OneWayUpgrade;
            }

            return ProjectUpgradeState.NotNeeded;
        }
开发者ID:munyirik,项目名称:nodejstools,代码行数:8,代码来源:BaseNodeProjectFactory.cs


示例8: ProjectOutputElement

 internal ProjectOutputElement (string taskParameter, string itemType, string propertyName,
                                ProjectRootElement containintProject)
 {
         TaskParameter = taskParameter;
         ItemType = itemType;
         PropertyName = propertyName;
         ContainingProject = containintProject;
 }
开发者ID:carrie901,项目名称:mono,代码行数:8,代码来源:ProjectOutputElement.cs


示例9: ProjectXmlChangedEventArgs

        /// <summary>
        /// Initializes a new instance of the <see cref="ProjectXmlChangedEventArgs"/> class
        /// that represents a change to a specific project root element.
        /// </summary>
        /// <param name="projectXml">The ProjectRootElement whose content was actually changed.</param>
        /// <param name="unformattedReason">The unformatted (may contain {0}) reason for the dirty event.</param>
        /// <param name="formattingParameter">The formatting parameter to use with <paramref name="unformattedReason"/>.</param>
        internal ProjectXmlChangedEventArgs(ProjectRootElement projectXml, string unformattedReason, string formattingParameter)
        {
            ErrorUtilities.VerifyThrowArgumentNull(projectXml, "projectXml");

            this.ProjectXml = projectXml;
            _unformattedReason = unformattedReason;
            _formattingParameter = formattingParameter;
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:15,代码来源:ProjectXmlChangedEventArgs.cs


示例10: AddItems

 private static void AddItems(ProjectRootElement elem, string groupName, params string[] items)
 {
     var group = elem.AddItemGroup();
     foreach (var item in items)
     {
         group.AddItem(groupName, item);
     }
 }
开发者ID:JannethAmaya,项目名称:RestAPIClientGenerator,代码行数:8,代码来源:ProjectFileGenerator.cs


示例11: Project

 public Project (ProjectRootElement xml, IDictionary<string, string> globalProperties,
                 string toolsVersion, ProjectCollection projectCollection,
                 ProjectLoadSettings loadSettings)
 {
         ProjectCollection = projectCollection;
         Xml = xml;
         GlobalProperties = globalProperties;
         ToolsVersion = toolsVersion;
 }
开发者ID:ngraziano,项目名称:mono,代码行数:9,代码来源:Project.cs


示例12: 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


示例13: UpgradeProject

 protected override void UpgradeProject(ref ProjectRootElement projectXml, ref ProjectRootElement userProjectXml, Action<__VSUL_ERRORLEVEL, string> log) {
     var envVarsProp = projectXml.Properties.FirstOrDefault(p => p.Name == NodejsConstants.EnvironmentVariables);
     if (envVarsProp != null) {
         var globals = projectXml.PropertyGroups.FirstOrDefault() ?? projectXml.AddPropertyGroup();
         AddOrSetProperty(globals, NodejsConstants.Environment, envVarsProp.Value.Replace(";", "\r\n"));
         envVarsProp.Parent.RemoveChild(envVarsProp);
         log(__VSUL_ERRORLEVEL.VSUL_INFORMATIONAL, SR.GetString(SR.UpgradedEnvironmentVariables));
     }
 }
开发者ID:munyirik,项目名称:nodejstools,代码行数:9,代码来源:BaseNodeProjectFactory.cs


示例14: ProjectUsingTaskParameterElement

 internal ProjectUsingTaskParameterElement (string name, string output, string required,
                                          string parameterType, ProjectRootElement containingProject)
 {
         Name = name;
         Output = output;
         Required = required;
         ParameterType = parameterType;
         ContainingProject = containingProject;
 }
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:9,代码来源:ProjectUsingTaskParameterElement.cs


示例15: ResolvedImport

        /// <summary>
        /// Initializes a new instance of the <see cref="ResolvedImport"/> struct.
        /// </summary>
        internal ResolvedImport(Project project, ProjectImportElement importingElement, ProjectRootElement importedProject)
        {
            ErrorUtilities.VerifyThrowInternalNull(importingElement, "parent");
            ErrorUtilities.VerifyThrowInternalNull(importedProject, "child");

            _importingElement = importingElement;
            _importedProject = importedProject;
            _isImported = !ReferenceEquals(project.Xml, importingElement.ContainingProject);
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:12,代码来源:ResolvedImport.cs


示例16: ProjectElement

        /// <summary>
        /// Constructor called by derived classes, except from ProjectRootElement.
        /// Parameters may not be null, except parent.
        /// </summary>
        internal ProjectElement(XmlElement xmlElement, ProjectElementContainer parent, ProjectRootElement containingProject)
        {
            ErrorUtilities.VerifyThrowArgumentNull(xmlElement, "xmlElement");
            ProjectXmlUtilities.VerifyThrowProjectValidNamespace((XmlElementWithLocation)xmlElement);
            ErrorUtilities.VerifyThrowArgumentNull(containingProject, "containingProject");

            this.XmlElement = (XmlElementWithLocation)xmlElement;
            _parent = parent;
            this.ContainingProject = containingProject;
        }
开发者ID:cdmihai,项目名称:msbuild,代码行数:14,代码来源:ProjectElement.cs


示例17: AddImport

		static ProjectImportElement AddImport(
			ProjectRootElement projectRoot,
			string importedProjectFile,
			ProjectImportLocation importLocation)
		{
			if (importLocation == ProjectImportLocation.Top) {
				return AddImportAtTop(projectRoot, importedProjectFile);
			}
			return projectRoot.AddImport(importedProjectFile);
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:10,代码来源:MSBuildBasedProjectExtensions.cs


示例18: CreateDisconnected

        /// <summary>
        /// Creates an unparented ProjectMetadataElement, wrapping an unparented XmlElement.
        /// Caller should then ensure the element is added to a parent.
        /// </summary>
        internal static ProjectMetadataElement CreateDisconnected(string name, ProjectRootElement containingProject)
        {
            XmlUtilities.VerifyThrowArgumentValidElementName(name);
            ErrorUtilities.VerifyThrowArgument(!FileUtilities.ItemSpecModifiers.IsItemSpecModifier(name), "ItemSpecModifierCannotBeCustomMetadata", name);
            ErrorUtilities.VerifyThrowInvalidOperation(XMakeElements.IllegalItemPropertyNames[name] == null, "CannotModifyReservedItemMetadata", name);

            XmlElementWithLocation element = containingProject.CreateElement(name);

            return new ProjectMetadataElement(element, containingProject);
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:14,代码来源:ProjectMetadataElement.cs


示例19: AddItemsWithLocation

        private static void AddItemsWithLocation(ProjectRootElement elem, string groupName, params string[] items)
        {
            var group = elem.AddItemGroup();
            foreach (var item in items)
            {
                ProjectItemElement element = group.AddItem(groupName, item);
                element.AddMetadata("HintPath", @"C:\" + item + ".dll");

            }
        }
开发者ID:JannethAmaya,项目名称:RestAPIClientGenerator,代码行数:10,代码来源:ProjectFileGenerator.cs


示例20: CreateDisconnected

        /// <summary>
        /// Creates an unparented ProjectOnErrorElement, wrapping an unparented XmlElement.
        /// Caller should then ensure the element is added to a parent.
        /// </summary>
        internal static ProjectOnErrorElement CreateDisconnected(string executeTargets, ProjectRootElement containingProject)
        {
            XmlElementWithLocation element = containingProject.CreateElement(XMakeElements.onError);

            ProjectOnErrorElement onError = new ProjectOnErrorElement(element, containingProject);

            onError.ExecuteTargetsAttribute = executeTargets;

            return onError;
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:14,代码来源:ProjectOnErrorElement.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Construction.XmlElementWithLocation类代码示例发布时间:2022-05-26
下一篇:
C# BuildEngine.Target类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap