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


C# BuildEngine.Target类代码示例

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


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

示例1: XnaContentProject

        public XnaContentProject(Task task, string msBuildPath, string xnaInstallPath)
        {
            m_engine = new Engine(msBuildPath);
            m_engine.RegisterLogger(new XnaContentLogger(task));
            m_project = new Project(m_engine);

            m_project.AddNewUsingTaskFromAssemblyName("BuildContent", "Microsoft.Xna.Framework.Content.Pipeline, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d");
            m_project.AddNewUsingTaskFromAssemblyName("BuildXact", "Microsoft.Xna.Framework.Content.Pipeline, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d");

            // Add our Content Pipeline Assemblies
            m_pipelineGroup = m_project.AddNewItemGroup();
            m_contentGroup = m_project.AddNewItemGroup();

            m_contentTarget = m_project.Targets.AddNewTarget("_BuildXNAContentLists");

            // Add our Build target
            m_xnaTarget = m_project.Targets.AddNewTarget("Build");
            m_xnaTarget.DependsOnTargets = "_BuildXNAContentLists";

            // Add Default Pipeline Assemblies.
            AddPilepineAssembly(xnaInstallPath + "Microsoft.Xna.Framework.Content.Pipeline.EffectImporter.dll");
            AddPilepineAssembly(xnaInstallPath + "Microsoft.Xna.Framework.Content.Pipeline.FBXImporter.dll");
            AddPilepineAssembly(xnaInstallPath + "Microsoft.Xna.Framework.Content.Pipeline.TextureImporter.dll");
            AddPilepineAssembly(xnaInstallPath + "Microsoft.Xna.Framework.Content.Pipeline.XImporter.dll");
        }
开发者ID:orj,项目名称:xnananttasks,代码行数:25,代码来源:XnaContentProject.cs

示例2: Visit

 public void Visit(UsingTaskToken token)
 {
     currentTarget = null; // Out of any previous target context
       valueResolver.Normalize(token);
       if (token["AssemblyFile"] != null)
     Project.AddNewUsingTaskFromAssemblyFile(token["TaskName"], token["AssemblyFile"]);
 }
开发者ID:flq,项目名称:rfb,代码行数:7,代码来源:MsBuildProjectBuilder.cs

示例3: Build

		public bool Build (Target target, out bool executeOnErrors)
		{
			executeOnErrors = false;
			try {
				string reason;
				if (!BuildTargetNeeded (out reason)) {
					LogTargetStarted (target);
					LogTargetSkipped (target, reason);
					LogTargetFinished (target, true);
					return true;
				}

				if (!String.IsNullOrEmpty (reason))
					target.Engine.LogMessage (MessageImportance.Low, reason);

				Init ();

				ParseTargetAttributes (target);
				BatchAndPrepareBuckets ();
				return Run (target, out executeOnErrors);
			} finally {
				consumedItemsByName = null;
				consumedMetadataReferences = null;
				consumedQMetadataReferences = null;
				consumedUQMetadataReferences = null;
				batchedItemsByName = null;
				commonItemsByName = null;
			}
		}
开发者ID:stabbylambda,项目名称:mono,代码行数:29,代码来源:TargetBatchingImpl.cs

示例4: TestFromXml2

		public void TestFromXml2 ()
		{
                        string documentString = @"
                                <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
					<Target Name='Target' Condition='false' DependsOnTargets='X' >
					</Target>
                                </Project>
                        ";

			engine = new Engine (Consts.BinPath);

                        project = engine.CreateNewProject ();
                        project.LoadXml (documentString);

			Target[] t = new Target [1];
			project.Targets.CopyTo (t, 0);

			Assert.AreEqual ("false", t [0].Condition, "A1");
			Assert.AreEqual ("X", t [0].DependsOnTargets, "A2");

			t [0].Condition = "true";
			t [0].DependsOnTargets = "A;B";

			Assert.AreEqual ("true", t [0].Condition, "A3");
			Assert.AreEqual ("A;B", t [0].DependsOnTargets, "A4");
		}
开发者ID:ancailliau,项目名称:mono,代码行数:26,代码来源:TargetTest.cs

示例5: GetTasks

		static BuildTask[] GetTasks (Target t)
		{
			List <BuildTask> list = new List <BuildTask> ();
			foreach (BuildTask bt in t)
				list.Add (bt);
			return list.ToArray ();
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:7,代码来源:BuildTaskTest.cs

示例6: TargetIdWrapper

        internal TargetInProgessState
        (
            EngineCallback engineCallback,
            Target target, 
            List<ProjectBuildState> waitingBuildStates,
            ProjectBuildState initiatingRequest,
            BuildRequest [] outstandingBuildRequests,
            string projectName
        )
        {
            this.targetId = new TargetIdWrapper(target);
            this.outstandingBuildRequests = outstandingBuildRequests;
            // For each waiting build context try to find the parent target
            this.parentBuildRequests = new List<BuildRequest>();
            this.parentTargets = new List<TargetIdWrapper>();
            this.projectName = projectName;

            // Process the waiting contexts if there are any
            if (waitingBuildStates != null)
            {
                for (int i = 0; i < waitingBuildStates.Count; i++)
                {
                    ProcessBuildContext(engineCallback, waitingBuildStates[i], target);
                }
            }
            // Process the initiating context
            ProcessBuildContext(engineCallback, initiatingRequest, target);
        }
开发者ID:nikson,项目名称:msbuild,代码行数:28,代码来源:TargetInProgressState.cs

示例7:

        internal TargetExecutionWrapper
        (
            Target targetClass,
            ArrayList taskElementList,
            List<string> targetParameters,
            XmlElement targetElement,
            Expander expander,
            BuildEventContext targetBuildEventContext
        )
        {
            // Initialize the data about the target XML that has been calculated in the target class
            this.targetClass   = targetClass;
            this.parentEngine  = targetClass.ParentEngine;
            this.parentProject = targetClass.ParentProject;
            this.targetElement   = targetElement;
            this.taskElementList = taskElementList;
            this.targetParameters = targetParameters;
            this.targetBuildEventContext = targetBuildEventContext;

            // Expand the list of depends on targets
            dependsOnTargetNames = expander.ExpandAllIntoStringList(targetClass.DependsOnTargets, targetClass.DependsOnTargetsAttribute);

            // Starting to build the target
            inProgressBuildState = InProgressBuildState.StartingBuild;
            // No messages have been logged
            loggedTargetStart = false;
        }
开发者ID:nikson,项目名称:msbuild,代码行数:27,代码来源:TargetExecutionWrapper.cs

示例8: Build

		public bool Build (Target target, out bool executeOnErrors)
		{
			executeOnErrors = false;
			try {
				if (!BuildTargetNeeded ()) {
					LogTargetStarted (target);
					LogTargetSkipped (target);
					LogTargetFinished (target, true);
					return true;
				}

				Init ();

				ParseTargetAttributes (target);
				BatchAndPrepareBuckets ();
				return Run (target, out executeOnErrors);
			} finally {
				consumedItemsByName = null;
				consumedMetadataReferences = null;
				consumedQMetadataReferences = null;
				consumedUQMetadataReferences = null;
				batchedItemsByName = null;
				commonItemsByName = null;
			}
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:25,代码来源:TargetBatchingImpl.cs

示例9: Run

		bool Run (Target target, out bool executeOnErrors)
		{
			executeOnErrors = false;
			if (buckets.Count > 0)
				return RunBatched (target, out executeOnErrors);
			else
				return RunUnbatched (target, out executeOnErrors);
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:8,代码来源:TargetBatchingImpl.cs

示例10: BuildTask

		internal BuildTask (XmlElement taskElement, Target parentTarget)
		{
			if (taskElement == null)
				throw new ArgumentNullException ("taskElement");
			if (parentTarget == null)
				throw new ArgumentNullException ("parentTarget");

			this.taskElement =  taskElement;
			this.parentTarget = parentTarget;
		}
开发者ID:rabink,项目名称:mono,代码行数:10,代码来源:BuildTask.cs

示例11: Run

		bool Run (Target target, out bool executeOnErrors)
		{
			executeOnErrors = false;
			if (buckets.Count > 0) {
				foreach (Dictionary<string, BuildItemGroup> bucket in buckets)
					if (!RunTargetWithBucket (bucket, target, out executeOnErrors))
						return false;

				return true;
			} else {
				return RunTargetWithBucket (null, target, out executeOnErrors);
			}
		}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:13,代码来源:TargetBatchingImpl.cs

示例12: TargetDependencyAnalyzer

        /// <summary>
        /// Creates an instance of this class for the given target.
        /// </summary>
        /// <owner>SumedhK</owner>
        internal TargetDependencyAnalyzer(string projectDirectory, Target targetToAnalyze, EngineLoggingServices loggingServices, BuildEventContext buildEventContext)
        {
            ErrorUtilities.VerifyThrow(projectDirectory != null, "Need a project directory.");
            ErrorUtilities.VerifyThrow(targetToAnalyze != null, "Need a target to analyze.");
            ErrorUtilities.VerifyThrow(targetToAnalyze.TargetElement != null, "Need a target element.");

            this.projectDirectory = projectDirectory;
            this.targetToAnalyze = targetToAnalyze;
            this.targetInputsAttribute = targetToAnalyze.TargetElement.Attributes[XMakeAttributes.inputs];
            this.targetOutputsAttribute = targetToAnalyze.TargetElement.Attributes[XMakeAttributes.outputs];
            this.loggingService = loggingServices;
            this.buildEventContext = buildEventContext;
        }
开发者ID:nikson,项目名称:msbuild,代码行数:17,代码来源:TargetDependencyAnalyzer.cs

示例13: ProcessBuildContext

        /// <summary>
        /// Figure out the parent target or the parent build request for the given context
        /// </summary>
        private void ProcessBuildContext(EngineCallback engineCallback, ProjectBuildState buildContext, Target target)
        {
            BuildRequest parentRequest = null;
            TargetIdWrapper parentName = FindParentTarget(engineCallback, buildContext, target, out parentRequest);

            if (parentName != null)
            {
                parentTargets.Add(parentName);
            }
            if (parentRequest != null)
            {
                parentBuildRequests.Add(parentRequest);
            }
        }
开发者ID:nikson,项目名称:msbuild,代码行数:17,代码来源:TargetInProgressState.cs

示例14: foreach

        /// <summary>
        /// This constructor initializes a persisted task from an existing task
        /// element which exists either in the main project file or one of the 
        /// imported files.
        /// </summary>
        /// <param name="taskElement"></param>
        /// <param name="parentTarget"></param>
        /// <param name="importedFromAnotherProject"></param>
        /// <owner>rgoel</owner>
        internal BuildTask
        (
            XmlElement      taskElement,
            Target          parentTarget,
            bool            importedFromAnotherProject
        )
        {
            // Make sure a valid node has been given to us.
            error.VerifyThrow(taskElement != null, "Need a valid XML node.");

            // Make sure a valid target has been given to us.
            error.VerifyThrow(parentTarget != null, "Need a valid target parent.");

            this.taskElement = taskElement;
            this.parentTarget = parentTarget;
            this.conditionAttribute = null;
            this.continueOnErrorAttribute = null;
            this.importedFromAnotherProject = importedFromAnotherProject;

            // Loop through all the attributes on the task element.
            foreach (XmlAttribute taskAttribute in taskElement.Attributes)
            {
                switch (taskAttribute.Name)
                {
                    case XMakeAttributes.condition:
                        this.conditionAttribute = taskAttribute;
                        break;

                    case XMakeAttributes.continueOnError:
                        this.continueOnErrorAttribute = taskAttribute;
                        break;

                    // this only makes sense in the context of the new OM, 
                    // so just ignore it.  
                    case XMakeAttributes.msbuildRuntime: 
                        // do nothing
                        break;

                    // this only makes sense in the context of the new OM, 
                    // so just ignore it.  
                    case XMakeAttributes.msbuildArchitecture:
                        // do nothing
                        break;
                }
            }

            this.taskName = taskElement.Name;
        }
开发者ID:nikson,项目名称:msbuild,代码行数:57,代码来源:BuildTask.cs

示例15: AddNewTarget

		public Target AddNewTarget (string targetName)
		{
			if (targetName == null)
				throw new InvalidProjectFileException (
					"The required attribute \"Name\" is missing from element <Target>.");
		
			XmlElement targetElement = parentProject.XmlDocument.CreateElement ("Target", Project.XmlNamespace);
			parentProject.XmlDocument.DocumentElement.AppendChild (targetElement);
			targetElement.SetAttribute ("Name", targetName);
			
			Target t = new Target (targetElement, parentProject, null);
			
			AddTarget (t);
			
			return t;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:16,代码来源:TargetCollection.cs


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