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


C# ProjectRootElement.AddProperty方法代码示例

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


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

示例1: AddOrSetProperty

        protected static void AddOrSetProperty(ProjectRootElement project, string name, string value) {
            bool anySet = false;
            foreach (var prop in project.Properties.Where(p => p.Name == name)) {
                prop.Value = value;
                anySet = true;
            }

            if (!anySet) {
                project.AddProperty(name, value);
            }
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:11,代码来源:ProjectCustomizations.cs

示例2: MSBuildBasedProject

		public MSBuildBasedProject(ProjectCreateInformation information)
		{
			this.projectCollection = information.Solution.MSBuildProjectCollection;
			this.projectFile = ProjectRootElement.Create(projectCollection);
			this.userProjectFile = ProjectRootElement.Create(projectCollection);
			this.ActivePlatform = information.Platform;
			
			Name = information.ProjectName;
			FileName = information.OutputProjectFileName;
			
			projectFile.FullPath = information.OutputProjectFileName;
			projectFile.ToolsVersion = "4.0";
			projectFile.DefaultTargets = "Build";
			userProjectFile.FullPath = information.OutputProjectFileName + ".user";
			
			base.IdGuid = "{" + Guid.NewGuid().ToString().ToUpperInvariant() + "}";
			projectFile.AddProperty(ProjectGuidPropertyName, IdGuid);
			AddGuardedProperty("Configuration", "Debug");
			AddGuardedProperty("Platform", information.Platform);
			
			this.ActiveConfiguration = "Debug";
			this.ActivePlatform = information.Platform;
			if (information.Platform == "x86")
				SetProperty(null, information.Platform, "PlatformTarget", "x86", PropertyStorageLocations.PlatformSpecific, false);
			else
				SetProperty(null, information.Platform, "PlatformTarget", "AnyCPU", PropertyStorageLocations.PlatformSpecific, false);
		}
开发者ID:Netring,项目名称:SharpDevelop,代码行数:27,代码来源:MSBuildBasedProject.cs

示例3: ConvertInMemoryToMSBuildProject


//.........这里部分代码省略.........

                    if (nextImport.Project.Contains(workflowOldWhidbeyTargetsPath))
                    {
                        listOfWFImportsToBeDeleted.Add(nextImport);
                        workflowImportsToAdd.Add(nextImport.Project.Replace(workflowOldWhidbeyTargetsPath, workflowNewTargetsPath));
                        removedWFWhidbeyTargets = true;
                    }
                    if (nextImport.Project.Contains(workflowOldOrcasTargetsPath))
                    {
                        listOfWFImportsToBeDeleted.Add(nextImport);
                        workflowImportsToAdd.Add(nextImport.Project.Replace(workflowOldOrcasTargetsPath, workflowNewTargetsPath));
                    }

                }

                // Now delete any matching imports
                foreach (ProjectImportElement importToDelete in listOfWFImportsToBeDeleted)
                {
                    this.xmakeProject.RemoveChild(importToDelete);
                    changedProject = true;
                }

                bool removedWinFXTargets = false;
                foreach (ProjectImportElement importToDelete in listOfImportsToBeDeleted)
                {
                    this.xmakeProject.RemoveChild(importToDelete);
                    removedWinFXTargets = true;
                    changedProject = true;
                }

                // If we removed WinFX targets this is a sparkle project and should use v3.0
                if (removedWinFXTargets)
                {
                    xmakeProject.AddProperty(XMakeProjectStrings.TargetFrameworkVersion, "v3.0");
                    changedProject = true;
                }

                //If we removed WFWhidbey imports, we should target this project to v3.0
                if (removedWFWhidbeyTargets)
                {
                    xmakeProject.AddProperty(XMakeProjectStrings.TargetFrameworkVersion, "v3.0");
                    changedProject = true;
                }


                // Re-add the workflow imports with the v4.0 targets.
                foreach (string workflowImportToAdd in workflowImportsToAdd)
                {
                    this.xmakeProject.AddImport(workflowImportToAdd);
                    changedProject = true;
                }

                // Find all the XAML files in the project and give them the custom attributes
                //   <Generator>MSBuild:Compile</Generator> (DevDiv Bugs bug 81222)
                //   <SubType>Designer</SubType> (DevDiv Bugs bug 82748)

                // Find all references to old VC project files (.vcproj extension) and change the
                // extension to .vcxproj instead.  NOTE: we assume that the actual .vcproj -> .vcxproj
                // conversion has already been / is being / will be done elsewhere.
                // Dev10 Bug 557388

                foreach (ProjectItemElement nextItem in xmakeProject.Items)
                {
                    if ((!nextItem.ItemType.Equals("Reference", StringComparison.OrdinalIgnoreCase)) &&
                        (nextItem.Include.Trim().EndsWith(".xaml", StringComparison.OrdinalIgnoreCase)))
                        
开发者ID:nikson,项目名称:msbuild,代码行数:66,代码来源:ProjectFileConverter.cs


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