當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。