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

C# Build.BuildEngine类代码示例

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

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



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

示例1: InitializeMSBuildProject

		internal static void InitializeMSBuildProject(MSBuild.Project project)
		{
			project.GlobalProperties.SetProperty("BuildingInsideVisualStudio", "true");
			foreach (KeyValuePair<string, string> pair in MSBuildEngine.MSBuildProperties) {
				project.GlobalProperties.SetProperty(pair.Key, pair.Value, true);
			}
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:7,代码来源:MSBuildBasedProject.cs


示例2: MSBuildBasedProject

		public MSBuildBasedProject(MSBuild.Engine engine)
		{
			if (engine == null)
				throw new ArgumentNullException("engine");
			this.project = engine.CreateNewProject();
			this.userProject = engine.CreateNewProject();
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:7,代码来源:MSBuildBasedProject.cs


示例3: GlobalPropertyHandler

        /// <summary>
        /// Overloaded constructor.
        /// </summary>
        /// <param name="project">An instance of a build project</param>
        /// <exception cref="ArgumentNullException">Is thrown if the passed Project is null.</exception>
        internal GlobalPropertyHandler(MSBuild.Project project)
        {
            Debug.Assert(project != null, "The project parameter passed cannot be null");

            this.globalProjectProperties = project.GlobalProperties;

            Debug.Assert(project.ParentEngine != null, "The parent engine has not been initialized");

            this.globalEngineProperties = project.ParentEngine.GlobalProperties;
        }
开发者ID:TerabyteX,项目名称:main,代码行数:15,代码来源:GlobalPropertyHandler.cs


示例4: ArgumentNullException

		internal static void AddItemToGroup(MSBuild.BuildItemGroup group, ProjectItem item)
		{
			if (group == null)
				throw new ArgumentNullException("group");
			if (item == null)
				throw new ArgumentNullException("item");
			if (item.IsAddedToProject)
				throw new ArgumentException("item is already added to project", "item");
			MSBuild.BuildItem newItem = group.AddNewItem(item.ItemType.ToString(), item.Include, true);
			foreach (string name in item.MetadataNames) {
				newItem.SetMetadata(name, item.GetMetadata(name));
			}
			item.BuildItem = newItem;
			Debug.Assert(item.IsAddedToProject);
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:15,代码来源:MSBuildInternals.cs


示例5: ProjectElement

        /// <summary>
        /// Constructor to Wrap an existing MSBuild.BuildItem
        /// Only have internal constructors as the only one who should be creating
        /// such object is the project itself (see Project.CreateFileNode()).
        /// </summary>
        /// <param name="project">Project that owns this item</param>
        /// <param name="existingItem">an MSBuild.BuildItem; can be null if virtualFolder is true</param>
        /// <param name="virtualFolder">Is this item virtual (such as reference folder)</param>
        internal ProjectElement(ProjectNode project, MSBuild.BuildItem existingItem, bool virtualFolder)
        {
            if (project == null)
                throw new ArgumentNullException("project");
            if (!virtualFolder && existingItem == null)
                throw new ArgumentNullException("existingItem");

            // Keep a reference to project and item
            this.itemProject = project;
            this.item = existingItem;
            this.isVirtual = virtualFolder;

            if (this.isVirtual)
                this.virtualProperties = new Dictionary<string, string>();
        }
开发者ID:Jeremiahf,项目名称:wix3,代码行数:23,代码来源:projectelement.cs


示例6: ProjectElement

        /// <summary>
        /// Constructor to Wrap an existing MSBuild.BuildItem
        /// Only have internal constructors as the only one who should be creating
        /// such object is the project itself (see Project.CreateFileNode()).
        /// </summary>
        /// <param name="project">Project that owns this item</param>
        /// <param name="existingItem">an MSBuild.BuildItem; can be null if virtualFolder is true</param>
        /// <param name="virtualFolder">Is this item virtual (such as reference folder)</param>
        internal ProjectElement(ProjectNode project, MSBuild.BuildItem existingItem, bool virtualFolder)
        {
            if (project == null)
                throw new ArgumentNullException("project", String.Format(CultureInfo.CurrentCulture, SR.GetString(SR.AddToNullProjectError), existingItem.Include));
            if (!virtualFolder && existingItem == null)
                throw new ArgumentNullException("existingItem");

            // Keep a reference to project and item
            itemProject = project;
            item = existingItem;
            isVirtual = virtualFolder;

            if (isVirtual)
                virtualProperties = new Dictionary<string, string>();
        }
开发者ID:Xtremrules,项目名称:dot42,代码行数:23,代码来源:ProjectElement.cs


示例7: EnsureCorrectTempProject

		internal static void EnsureCorrectTempProject(MSBuild.Project baseProject,
		                                              string configuration, string platform,
		                                              ref MSBuild.Project tempProject)
		{
			if (configuration == null && platform == null) {
				// unload temp project
				if (tempProject != null && tempProject != baseProject) {
					tempProject.ParentEngine.UnloadAllProjects();
				}
				tempProject = null;
				return;
			}
			if (configuration == null)
				configuration = baseProject.GetEvaluatedProperty("Configuration");
			if (platform == null)
				platform = baseProject.GetEvaluatedProperty("Platform");
			
			if (tempProject != null
			    && tempProject.GetEvaluatedProperty("Configuration") == configuration
			    && tempProject.GetEvaluatedProperty("Platform") == platform)
			{
				// already correct
				return;
			}
			if (baseProject.GetEvaluatedProperty("Configuration") == configuration
			    && baseProject.GetEvaluatedProperty("Platform") == platform)
			{
				tempProject = baseProject;
				return;
			}
			// create new project
			
			// unload old temp project
			if (tempProject != null && tempProject != baseProject) {
				tempProject.ParentEngine.UnloadAllProjects();
			}
			try {
				MSBuild.Engine engine = CreateEngine();
				tempProject = engine.CreateNewProject();
				MSBuildBasedProject.InitializeMSBuildProject(tempProject);
				tempProject.LoadXml(baseProject.Xml);
				tempProject.SetProperty("Configuration", configuration);
				tempProject.SetProperty("Platform", platform);
			} catch (Exception ex) {
				ICSharpCode.Core.MessageService.ShowWarning(ex.ToString());
				tempProject = baseProject;
			}
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:48,代码来源:MSBuildInternals.cs


示例8: CreateProjectItem

		/// <summary>
		/// Creates a new projectItem for the passed itemType
		/// </summary>
		public override ProjectItem CreateProjectItem(MSBuild.BuildItem item)
		{
			switch (item.Name) {
				case "Reference":
					return new ReferenceProjectItem(this, item);
				case "ProjectReference":
					return new ProjectReferenceProjectItem(this, item);
				case "COMReference":
					return new ComReferenceProjectItem(this, item);
				case "Import":
					return new ImportProjectItem(this, item);
					
				case "None":
				case "Compile":
				case "EmbeddedResource":
				case "Resource":
				case "Content":
				case "Folder":
					return new FileProjectItem(this, item);
					
				case "WebReferenceUrl":
					return new WebReferenceUrl(this, item);
					
				case "WebReferences":
					return new WebReferencesProjectItem(this, item);
					
				default:
					if (this.AvailableFileItemTypes.Contains(new ItemType(item.Name))
					    || SafeFileExists(this.Directory, item.FinalItemSpec))
					{
						return new FileProjectItem(this, item);
					} else {
						return base.CreateProjectItem(item);
					}
			}
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:39,代码来源:MSBuildBasedProject.cs


示例9: GetItemParentNode

		/// <summary>
		/// Get the parent node of an msbuild item
		/// </summary>
		/// <param name="item">msbuild item</param>
		/// <returns>parent node</returns>
		private HierarchyNode GetItemParentNode(MSBuild.BuildItem item)
		{
			HierarchyNode currentParent = this;
			string strPath = item.FinalItemSpec;

			strPath = Path.GetDirectoryName(strPath);
			if(strPath.Length > 0)
			{
				// Use the relative to verify the folders...
				currentParent = this.CreateFolderNodes(strPath);
			}
			return currentParent;
		}
开发者ID:jijo-paulose,项目名称:bistro-framework,代码行数:18,代码来源:ProjectNode.cs


示例10: GetOutputPath

		private string GetOutputPath(MSBuild.BuildPropertyGroup properties)
		{
			this.currentConfig = properties;
			string outputPath = GetProjectProperty("OutputPath");

			if(!String.IsNullOrEmpty(outputPath))
			{
				outputPath = outputPath.Replace('/', Path.DirectorySeparatorChar);
				if(outputPath[outputPath.Length - 1] != Path.DirectorySeparatorChar)
					outputPath += Path.DirectorySeparatorChar;
			}

			return outputPath;
		}
开发者ID:jijo-paulose,项目名称:bistro-framework,代码行数:14,代码来源:ProjectNode.cs


示例11: AddDependentFileNodeToNode

		/// <summary>
		/// Add a dependent file node to the hierarchy
		/// </summary>
		/// <param name="item">msbuild item to add</param>
		/// <param name="parentNode">Parent Node</param>
		/// <returns>Added node</returns>
		private HierarchyNode AddDependentFileNodeToNode(MSBuild.BuildItem item, HierarchyNode parentNode)
		{
			FileNode node = this.CreateDependentFileNode(new ProjectElement(this, item, false));
			parentNode.AddChild(node);

			// Make sure to set the HasNameRelation flag on the dependent node if it is related to the parent by name
			if(!node.HasParentNodeNameRelation && string.Compare(node.GetRelationalName(), parentNode.GetRelationalName(), StringComparison.OrdinalIgnoreCase) == 0)
			{
				node.HasParentNodeNameRelation = true;
			}

			return node;
		}
开发者ID:jijo-paulose,项目名称:bistro-framework,代码行数:19,代码来源:ProjectNode.cs


示例12: AddFileNodeToNode

		/// <summary>
		/// Add a file node to the hierarchy
		/// </summary>
		/// <param name="item">msbuild item to add</param>
		/// <param name="parentNode">Parent Node</param>
		/// <returns>Added node</returns>
		private HierarchyNode AddFileNodeToNode(MSBuild.BuildItem item, HierarchyNode parentNode)
		{
			FileNode node = this.CreateFileNode(new ProjectElement(this, item, false));
			parentNode.AddChild(node);
			return node;
		}
开发者ID:jijo-paulose,项目名称:bistro-framework,代码行数:12,代码来源:ProjectNode.cs


示例13: EndXmlManipulation

		static void EndXmlManipulation(MSBuild.Project project)
		{
			MarkProjectAsDirtyForReprocessXml(project);
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:4,代码来源:MSBuildInternals.cs


示例14: SetImportProjectPath

		/// <summary>
		/// Changes the value of the ProjectPath property on an existing import.
		/// Note: this methods causes the project to recreate all imports, so existing import
		/// instances might not be affected.
		/// </summary>
		public static void SetImportProjectPath(MSBuildBasedProject project, MSBuild.Import import,
		                                        string newRawPath)
		{
			if (project == null)
				throw new ArgumentNullException("project");
			if (import == null)
				throw new ArgumentNullException("import");
			if (newRawPath == null)
				throw new ArgumentNullException("newRawPath");
			
			lock (project.SyncRoot) {
				XmlAttribute a = (XmlAttribute)typeof(MSBuild.Import).InvokeMember(
					"ProjectPathAttribute",
					BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.NonPublic,
					null, import, null
				);
				a.Value = newRawPath;
				EndXmlManipulation(project.MSBuildProject);
			}
			project.CreateItemsListFromMSBuild();
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:26,代码来源:MSBuildInternals.cs


示例15: GetCustomMetadataNames

		/// <summary>
		/// Gets all custom metadata names defined directly on the item, ignoring defaulted metadata entries.
		/// </summary>
		public static IList<string> GetCustomMetadataNames(MSBuild.BuildItem item)
		{
			PropertyInfo prop = typeof(MSBuild.BuildItem).GetProperty("ItemDefinitionLibrary", BindingFlags.Instance | BindingFlags.NonPublic);
			object oldValue = prop.GetValue(item, null);
			prop.SetValue(item, null, null);
			IList<string> result = (IList<string>)item.CustomMetadataNames;
			prop.SetValue(item, oldValue, null);
			return result;
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:12,代码来源:MSBuildInternals.cs


示例16: LoadReferencesFromBuildProject

        /// <summary>
        /// Adds references to this container from a MSBuild project.
        /// </summary>
        public void LoadReferencesFromBuildProject(MSBuild.Project buildProject)
        {
            foreach (string referenceType in SupportedReferenceTypes)
            {
                MSBuild.BuildItemGroup refererncesGroup = buildProject.GetEvaluatedItemsByName(referenceType);

                bool isAssemblyReference = referenceType == ProjectFileConstants.Reference;
                // If the project was loaded for browsing we should still create the nodes but as not resolved.
                if (this.ProjectMgr.HasPassedSecurityChecks && isAssemblyReference && this.ProjectMgr.Build(MsBuildTarget.ResolveAssemblyReferences) != MSBuildResult.Successful)
                {
                    continue;
                }

                foreach (MSBuild.BuildItem item in refererncesGroup)
                {
                    ProjectElement element = new ProjectElement(this.ProjectMgr, item, false);

                    ReferenceNode node = CreateReferenceNode(referenceType, element);

                    if (node != null)
                    {
                        // Make sure that we do not want to add the item twice to the ui hierarchy
                        // We are using here the UI representation of the Node namely the Caption to find that out, in order to
                        // avoid different representation problems.
                        // Example :<Reference Include="EnvDTE80, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
                        //		  <Reference Include="EnvDTE80" />
                        bool found = false;
                        for (HierarchyNode n = this.FirstChild; n != null && !found; n = n.NextSibling)
                        {
                            if (String.Compare(n.Caption, node.Caption, StringComparison.OrdinalIgnoreCase) == 0)
                            {
                                found = true;
                            }
                        }

                        if (!found)
                        {
                            this.AddChild(node);
                        }
                    }
                }
            }
        }
开发者ID:Jeremiahf,项目名称:wix3,代码行数:46,代码来源:referencecontainernode.cs


示例17: GetBoolAttr

        /// <include file='doc\Project.uex' path='docs/doc[@for="Project.GetBoolAttr"]/*' />
        private bool GetBoolAttr(MSBuild.PropertyGroup properties, string name)
        {
            this.currentConfig = properties;
            string s = GetProjectProperty(name);

            return (s != null && s.ToLower().Trim() == "true");
        }
开发者ID:hesam,项目名称:SketchSharp,代码行数:8,代码来源:Project.cs


示例18: GetAssemblyName

        /// <include file='doc\Project.uex' path='docs/doc[@for="Project.GetAssemblyName"]/*' />
        private string GetAssemblyName(MSBuild.PropertyGroup properties)
        {
            this.currentConfig = properties;
            string name = null;

            name = GetProjectProperty("AssemblyName");
            if (name == null)
                name = this.Caption;

            string outputtype = GetProjectProperty("OutputType", false);

            if (outputtype == "library")
            {
                outputtype = outputtype.ToLower();
                name += ".dll";
            }
            else
            {
                name += ".exe";
            }

            return name;
        }
开发者ID:hesam,项目名称:SketchSharp,代码行数:24,代码来源:Project.cs


示例19: ProjectElement

        /// <summary>
        /// Constructor to Wrap an existing MSBuild.Item
        /// Only have internal constructors as the only one who should be creating
        /// such object is the project itself (see Project.CreateFileNode()).
        /// </summary>
        /// <param name="project">Project that owns this item</param>
        /// <param name="existingItem">an MSBuild.Item; can be null if virtualFolder is true</param>
        /// <param name="virtualFolder">Is this item virtual (such as reference folder)</param>
        internal ProjectElement(Project project, MSBuild.Item existingItem, bool virtualFolder)
        {
            if (project == null)
                throw new ArgumentNullException("project", String.Format(SR.GetString(SR.AddToNullProjectError), existingItem.Include));
            if (!virtualFolder && existingItem == null)
                throw new ArgumentNullException("existingItem");

            // Keep a reference to project and item
            itemProject = project;
            item = existingItem;
            isVirtual = virtualFolder;
        }
开发者ID:hesam,项目名称:SketchSharp,代码行数:20,代码来源:Project.cs


示例20: ClonePropertyGroup

        /// <summary>
        /// For internal use only.
        /// This creates a copy of an existing configuration and add it to the project.
        /// Caller should change the condition on the PropertyGroup.
        /// If derived class want to accomplish this, they should call ConfigProvider.AddCfgsOfCfgName()
        /// It is expected that in the future MSBuild will have support for this so we don't have to
        /// do it manually.
        /// </summary>
        /// <param name="group">PropertyGroup to clone</param>
        /// <returns></returns>
        internal MSBuild.PropertyGroup ClonePropertyGroup(MSBuild.PropertyGroup group)
        {
            // Create a new (empty) PropertyGroup
            MSBuild.PropertyGroup newPropertyGroup = this.projFile.AddNewPropertyGroup(true);

            // Now copy everything from the group we are trying to clone to the group we are creating
            if (group.Condition != "")
                newPropertyGroup.Condition = group.Condition;
            foreach (MSBuild.Property prop in group)
            {
                MSBuild.Property newProperty = newPropertyGroup.AddNewProperty(prop.Name, prop.Value);
                if (prop.Condition != "")
                    newProperty.Condition = prop.Condition;
            }

            return newPropertyGroup;
        }
开发者ID:hesam,项目名称:SketchSharp,代码行数:27,代码来源:Project.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Build.Evaluation类代码示例发布时间:2022-05-24
下一篇:
C# Microsoft.Build类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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