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


C# Build.BuildEngine类代码示例

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


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

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

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

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

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

示例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", 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

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

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

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

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

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

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

示例12: EndXmlManipulation

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

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

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

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


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