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

C# BuildEngine.BuildItem类代码示例

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

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



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

示例1: CacheEntryGettersDefaultConstructors

        public void CacheEntryGettersDefaultConstructors()
        {
            BuildItem[] buildItems = new BuildItem[2] { null, null };

            BuildItemCacheEntry tice = new BuildItemCacheEntry();
            Assertion.AssertEquals(null, tice.Name);
            Assertion.AssertEquals(null, tice.BuildItems);
            
            tice.Name = "tice";
            tice.BuildItems = buildItems;
            Assertion.AssertEquals("tice", tice.Name);
            Assertion.AssertEquals(buildItems, tice.BuildItems);

            PropertyCacheEntry pce = new PropertyCacheEntry();
            Assertion.AssertEquals(null, pce.Name);
            Assertion.AssertEquals(null, pce.Value);

            pce.Name = "pce";
            pce.Value = "propertyValue";
            Assertion.AssertEquals("pce", pce.Name);
            Assertion.AssertEquals("propertyValue", pce.Value);

            BuildResultCacheEntry brce = new BuildResultCacheEntry();
            Assertion.AssertEquals(null, brce.Name);
            Assertion.AssertEquals(null, brce.BuildItems);
            Assertion.AssertEquals(default(bool), brce.BuildResult);

            brce.Name = "brce";
            brce.BuildItems = buildItems;
            brce.BuildResult = false;
            Assertion.AssertEquals("brce", brce.Name);
            Assertion.AssertEquals(buildItems, brce.BuildItems);
            Assertion.AssertEquals(false, brce.BuildResult);
        }
开发者ID:nikson,项目名称:msbuild,代码行数:34,代码来源:CacheEntry_Tests.cs


示例2: BuildItemProxy

        internal BuildItemProxy(object buildItem)
        {
            instance = (Microsoft.Build.BuildEngine.BuildItem)buildItem;

            // I am not sure what's going on here, but sometimes, in particular when the project is initialized
            // the build item is not what we are getting here, but rather the child element
            // 'get_ParentPersistedItem" gives us what we need
            var persisted_instance = (BuildItem)typeof(BuildItem)
                .InvokeMember("get_ParentPersistedItem", BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Instance, null, instance, new object[] { });
            if (persisted_instance != null)
                instance = persisted_instance;

            buildItemGroup = (BuildItemGroup)typeof(BuildItem)
                .InvokeMember("get_ParentPersistedItemGroup", BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Instance,
                null, instance, new object[] { });

            int i = -1;
            foreach (BuildItem item in buildItemGroup)
            {
                i++;
                if (item == instance)
                {
                    index = i;
                    break;
                }
            }

            Include = instance.Include;
            Type = instance.Name;
        }
开发者ID:Hill30,项目名称:F--Project-Extender,代码行数:30,代码来源:BuildItemProxy2008.cs


示例3: Initialize

        public void Initialize()
        {
            // Create some items and place them in a dictionary
            // Add some include information so that when we check the final 
            // item spec we can verify that the item was recreated properly
            BuildItem buildItem1 = new BuildItem("BuildItem1", "Item1");
            buildItem1.Include = "TestInclude1";
            BuildItem[] buildItems = new BuildItem[1];
            buildItems[0] = buildItem1;
            Dictionary<object, object> dictionary = new Dictionary<object, object>();
            dictionary.Add("TaskItems", buildItems);

            Hashtable resultByTargetSuccess = new Hashtable(StringComparer.OrdinalIgnoreCase);
            resultByTargetSuccess.Add("TaskItems", Target.BuildState.CompletedSuccessfully);
            Hashtable resultByTargetFailure = new Hashtable(StringComparer.OrdinalIgnoreCase);
            resultByTargetFailure.Add("TaskItems", Target.BuildState.CompletedUnsuccessfully);
            Hashtable resultByTargetSkipped = new Hashtable(StringComparer.OrdinalIgnoreCase);
            resultByTargetSkipped.Add("TaskItems", Target.BuildState.Skipped);

            resultWithOutputs = new BuildResult(dictionary, resultByTargetSuccess, true, 1, 1, 3, true, string.Empty, string.Empty, 0, 0, 0);
            failedResult = new BuildResult(dictionary, resultByTargetFailure, false, 1, 1, 3, true, string.Empty, string.Empty, 0, 0, 0);
            uncacheableResult = new BuildResult(dictionary, resultByTargetSkipped, true, 1, 1, 3, true, string.Empty, string.Empty, 0, 0, 0);

            cacheScope = new CacheScope("temp.proj", new BuildPropertyGroup(), "3.5");
        }
开发者ID:nikson,项目名称:msbuild,代码行数:25,代码来源:NodeRequestMapping_Tests.cs


示例4: Initialize

        public void Initialize()
        {
            // Create some items and place them in a dictionary
            // Add some include information so that when we check the final 
            // item spec we can verify that the item was recreated properly
            BuildItem[] buildItems = new BuildItem[1];
            buildItems[0] = new BuildItem("BuildItem1", "Item1");
            Dictionary<object, object> dictionary1 = new Dictionary<object, object>();
            dictionary1.Add("Target1", buildItems);
            Hashtable resultsByTarget1 = new Hashtable(StringComparer.OrdinalIgnoreCase);
            resultsByTarget1.Add("Target1", Target.BuildState.CompletedSuccessfully);

            Dictionary<object, object> dictionary2 = new Dictionary<object, object>();
            dictionary2.Add("Target2", buildItems);
            dictionary2.Add("Target3", null);
            Hashtable resultsByTarget2 = new Hashtable(StringComparer.OrdinalIgnoreCase);
            resultsByTarget2.Add("Target2", Target.BuildState.CompletedSuccessfully);
            resultsByTarget2.Add("Target3", Target.BuildState.CompletedSuccessfully);

            Dictionary<object, object> dictionary3 = new Dictionary<object, object>();
            dictionary3.Add("Target4", buildItems);
            Hashtable resultsByTarget3 = new Hashtable(StringComparer.OrdinalIgnoreCase);
            resultsByTarget3.Add("Target4", Target.BuildState.Skipped);

            resultWith0Outputs = new BuildResult(new Hashtable(), new Hashtable(StringComparer.OrdinalIgnoreCase), true, 1, 1, 2, true, string.Empty, string.Empty, 0, 0, 0);
            resultWith1Outputs = new BuildResult(dictionary1, resultsByTarget1, true, 1, 1, 2, true, string.Empty, string.Empty, 0, 0, 0);
            resultWith2Outputs = new BuildResult(dictionary2, resultsByTarget2, true, 1, 1, 2, true, string.Empty, string.Empty, 0, 0, 0);
            uncacheableResult = new BuildResult(dictionary3, resultsByTarget3, true, 1, 1, 2, true, string.Empty, string.Empty, 0, 0, 0);
        }
开发者ID:nikson,项目名称:msbuild,代码行数:29,代码来源:CacheScope_Tests.cs


示例5: ProjectElement

        /// <summary>
        /// Constructor to create a new MSBuild.BuildItem and add it to the project
        /// Only have internal constructors as the only one who should be creating
        /// such object is the project itself (see Project.CreateFileNode()).
        /// </summary>
        internal ProjectElement(ProjectNode project, string itemPath, string itemType)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }

            if (String.IsNullOrEmpty(itemPath))
            {
                throw new ArgumentException(SR.GetString(SR.ParameterCannotBeNullOrEmpty, CultureInfo.CurrentUICulture), "itemPath");
            }

            if (String.IsNullOrEmpty(itemType))
            {
                throw new ArgumentException(SR.GetString(SR.ParameterCannotBeNullOrEmpty, CultureInfo.CurrentUICulture), "itemType");
            }

            this.itemProject = project;

            // create and add the item to the project

            this.item = project.BuildProject.AddNewItem(itemType, Microsoft.Build.BuildEngine.Utilities.Escape(itemPath));
            this.itemProject.SetProjectFileDirty(true);
            this.RefreshProperties();
        }
开发者ID:Jeremiahf,项目名称:wix3,代码行数:30,代码来源:projectelement.cs


示例6: BasicProxying

        public void BasicProxying()
        {          
            BuildItemGroup ig = new BuildItemGroup();
            BuildItem i1 = new BuildItem("name1", "value1");
            i1.SetMetadata("myMetaName", "myMetaValue");
            BuildItem i2 = new BuildItem("name2", "value2");
            ig.AddItem(i1);
            ig.AddItem(i2);

            BuildItemGroupProxy proxy = new BuildItemGroupProxy(ig);

            // Gather everything into our own table
            Hashtable list = new Hashtable(StringComparer.OrdinalIgnoreCase);
            foreach (DictionaryEntry item in proxy)
            {
                list.Add(item.Key, item.Value);
            }

            // Check we got all the items
            Assertion.AssertEquals(2, list.Count);
            Assertion.AssertEquals("value1", ((TaskItem)list["name1"]).ItemSpec);
            Assertion.AssertEquals("value2", ((TaskItem)list["name2"]).ItemSpec);

            // Check they have all their metadata
            int builtInMetadata = FileUtilities.ItemSpecModifiers.All.Length;
            Assertion.AssertEquals(1 + builtInMetadata, ((TaskItem)list["name1"]).MetadataCount);
            Assertion.AssertEquals(0 + builtInMetadata, ((TaskItem)list["name2"]).MetadataCount);
            Assertion.AssertEquals("myMetaValue", ((TaskItem)list["name1"]).GetMetadata("myMetaName"));
        }
开发者ID:nikson,项目名称:msbuild,代码行数:29,代码来源:BuildItemGroupProxy_Tests.cs


示例7: BuildItemGroup

		internal BuildItemGroup (XmlElement xmlElement, Project project, ImportedProject importedProject, bool readOnly, bool dynamic)
		{
			this.buildItems = new List <BuildItem> ();
			this.importedProject = importedProject;
			this.itemGroupElement = xmlElement;
			this.parentProject = project;
			this.read_only = readOnly;
			this.isDynamic = dynamic;
			
			if (!FromXml)
				return;

			foreach (XmlNode xn in xmlElement.ChildNodes) {
				if (!(xn is XmlElement))
					continue;
					
				XmlElement xe = (XmlElement) xn;
				BuildItem bi = new BuildItem (xe, this);
				buildItems.Add (bi);
				project.LastItemGroupContaining [bi.Name] = this;
			}

			DefinedInFileName = importedProject != null ? importedProject.FullFileName :
						project != null ? project.FullFileName : null;
		}
开发者ID:ANahr,项目名称:mono,代码行数:25,代码来源:BuildItemGroup.cs


示例8: IsOrphaned

        public static bool IsOrphaned(BuildItem buildItem, ProjectBase owner)
        {
            bool considerBuildItem = (buildItem.Name == "Compile" || buildItem.Name == "Content" || buildItem.Name == "None");

            if(!considerBuildItem)
            {
                if (owner is VisualStudioProject)
                {
                    var asVisualStudioProject = owner as VisualStudioProject;

                    if (!considerBuildItem && buildItem.Name == asVisualStudioProject.DefaultContentAction)
                    {
                        considerBuildItem = true;
                    }
                }
            }

            if (considerBuildItem)
            {
                // characters like '%' are encoded, so we have to decode them:
                string relativeName = System.Web.HttpUtility.UrlDecode( buildItem.Include);
                string fullName = owner.MakeAbsolute(relativeName);
                return !FileManager.FileExists(fullName) && buildItem.Name != "ProjectReference";
            }
            return false;
        }
开发者ID:GorillaOne,项目名称:FlatRedBall,代码行数:26,代码来源:BuildItemViewModel.cs


示例9: AssertItemsMatch

 /// <summary>
 /// Amazingly sophisticated :) helper function to determine if the set of ITaskItems returned from 
 /// a task match the expected set of ITaskItems.  It can also check that the ITaskItems have the expected
 /// metadata, and that the ITaskItems are returned in the correct order.
 /// 
 /// The "expectedItemsString" is a formatted way of easily specifying which items you expect to see.
 /// The format is:
 /// 
 ///         itemspec1 :   metadataname1=metadatavalue1 ; metadataname2=metadatavalue2 ; ...
 ///         itemspec2 :   metadataname3=metadatavalue3 ; metadataname4=metadatavalue4 ; ...
 ///         itemspec3 :   metadataname5=metadatavalue5 ; metadataname6=metadatavalue6 ; ...
 /// 
 /// (Each item needs to be on its own line.)
 /// 
 /// </summary>
 /// <param name="expectedItemsString"></param>
 /// <param name="actualItems"></param>
 /// <owner>RGoel</owner>
 static internal void AssertItemsMatch
     (
     string expectedItemsString, 
     BuildItem[] actualItems
     )
 {
     AssertItemsMatch(expectedItemsString, actualItems, true);
 }
开发者ID:nikson,项目名称:msbuild,代码行数:26,代码来源:enginehelpers.cs


示例10: Basic

 public void Basic()
 {
     BuildItem item = new BuildItem("i", "i1");
     Assertion.AssertEquals("i", item.Name);
     Assertion.AssertEquals("i1", item.EvaluatedItemSpec);
     Assertion.AssertEquals("i1", item.FinalItemSpec);
     Assertion.AssertEquals("i1", item.FinalItemSpecEscaped);
 }
开发者ID:nikson,项目名称:msbuild,代码行数:8,代码来源:BuildItem_Tests.cs


示例11: AddDependencies

		public void AddDependencies(ProjectInfo[] depends)
		{
			foreach (ProjectInfo proj in depends)
			{
				BuildItem bi = new BuildItem("Reference", proj.AssemblyName);
				bi.SetMetadata("SpecificVersion", false.ToString());
				bi.SetMetadata("HintPath", proj.AbsoluteOutputPath);
				_psedoDepends.Add(new ProjectRef(bi, GetProjectPath));
			}
		}
开发者ID:hivie7510,项目名称:csharptest-net,代码行数:10,代码来源:ProjectInfo.References.cs


示例12: GetReferenceDllName

 private string GetReferenceDllName(BuildItem item)
 {
     string spec = item.FinalItemSpec;
     int commaIndex = spec.IndexOf(CHAR_Comma);
     if (commaIndex >= 0)
     {
         return spec.Substring(0, commaIndex);
     }
     return spec;
 }
开发者ID:kevinmiles,项目名称:dxcorecommunityplugins,代码行数:10,代码来源:VS2005ProjectLoader.cs


示例13: GetAssemblyPathFromVSInstalDir

 private string GetAssemblyPathFromVSInstalDir(BuildItem item)
 {
     string name = GetReferenceDllName(item);
     string[] installDirs = FrameworkHelper.GetVSInstallFoldersPaths();
     string path = FrameworkHelper.GetAssemblyPath(name, installDirs);
     if (File.Exists(path))
     {
         return path;
     }
     return string.Empty;
 }
开发者ID:kevinmiles,项目名称:dxcorecommunityplugins,代码行数:11,代码来源:VS2005ProjectLoader.cs


示例14: ProjectElement

        /// <summary>
        /// Constructor to create a new MSBuild.BuildItem and add it to the project
        /// Only have internal constructors as the only one who should be creating
        /// such object is the project itself (see Project.CreateFileNode()).
        /// </summary>
        internal ProjectElement(ProjectNode project, string itemPath, string itemType)
        {
            if (project == null)
                throw new ArgumentNullException("project", String.Format(CultureInfo.CurrentCulture, SR.GetString(SR.AddToNullProjectError), itemPath));

            itemProject = project;

            // create and add the item to the project
            item = project.BuildProject.AddNewItem(itemType, itemPath);
            project.SetProjectFileDirty(true);
            this.RefreshProperties();
        }
开发者ID:Xtremrules,项目名称:dot42,代码行数:17,代码来源:ProjectElement.cs


示例15: Hashtable

        /// <summary>
        /// Copy constructor
        /// </summary>
        internal BuildResult
            (BuildResult buildResultToCopy, bool deepCopy)
        {
            ErrorUtilities.VerifyThrowArgumentNull(buildResultToCopy, "Cannot have a null build result passed in");
            this.flags = buildResultToCopy.flags;
            this.handleId = buildResultToCopy.handleId;
            this.requestId = buildResultToCopy.requestId;
            this.projectId = buildResultToCopy.projectId;
            this.outputsByTarget = new Hashtable();
            this.defaultTargets = buildResultToCopy.defaultTargets;
            this.initialTargets = buildResultToCopy.initialTargets;
            this.resultByTarget = new Hashtable(buildResultToCopy.resultByTarget, StringComparer.OrdinalIgnoreCase);

            if (buildResultToCopy.outputsByTarget == null)
            {
                return;
            }

            if (deepCopy)
            {
                // Copy all the old data
                foreach (DictionaryEntry entry in buildResultToCopy.outputsByTarget)
                {
                    // Make deep copies of all the target outputs before
                    // passing them back
                    BuildItem[] originalArray = (BuildItem[])entry.Value;
                    BuildItem[] itemArray = new BuildItem[originalArray.Length];
                    for (int i = 0; i < originalArray.Length; i++)
                    {
                        if (!originalArray[i].IsUninitializedItem)
                        {
                            itemArray[i] = originalArray[i].Clone();
                            itemArray[i].CloneVirtualMetadata();
                        }
                        else
                        {
                            itemArray[i] = new BuildItem(null, originalArray[i].FinalItemSpecEscaped);
                        }
                    }
                    
                    this.outputsByTarget.Add(entry.Key, itemArray);
                }
            }
            else
            {
                // Create a new hashtable but point at the same data
                foreach (DictionaryEntry entry in buildResultToCopy.outputsByTarget)
                {
                    this.outputsByTarget.Add(entry.Key, entry.Value);
                }
            }
        }
开发者ID:nikson,项目名称:msbuild,代码行数:55,代码来源:BuildResult.cs


示例16: TestCtor1

		public void TestCtor1 ()
		{
			string itemName = "itemName";
			string itemInclude = "a;b;c";
	
			item = new BuildItem (itemName, itemInclude);
	
			Assert.AreEqual (itemInclude, item.FinalItemSpec, "A1");
			Assert.AreEqual (itemInclude, item.Include, "A2");
			Assert.AreEqual (String.Empty, item.Exclude, "A3");
			Assert.AreEqual (String.Empty, item.Condition, "A4");
			Assert.AreEqual (false, item.IsImported, "A5");
			Assert.AreEqual (itemName, item.Name, "A6");
		}
开发者ID:GirlD,项目名称:mono,代码行数:14,代码来源:BuildItemTest.cs


示例17: 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:vestild,项目名称:nemerle,代码行数:23,代码来源:ProjectElement.cs


示例18: FromFileReference

		private void FromFileReference(BuildItem bi, TranslatePath fnTranslate)
		{
			if (!String.IsNullOrEmpty(bi.Include))
			{
				this.Assembly = new AssemblyName(bi.Include);
				SpecificVersion |= this.Assembly.Version != null;
			}
			if (!String.IsNullOrEmpty(bi.GetMetadata("HintPath")))
			{
				string path = bi.GetMetadata("HintPath");
				fnTranslate(ref path);//< output file doesn't nessessarily exist
				this.Output = path;
			}
			this.RequiresVersion = bi.GetMetadata("RequiredTargetFramework");
		}
开发者ID:hivie7510,项目名称:csharptest-net,代码行数:15,代码来源:ProjectRef.cs


示例19: ProjectRef

		public ProjectRef(BuildItem item, TranslatePath fnTranslate)
		{
			this.RefType = String.Format("{0}", Check.NotNull(item).Name);
			if (item.GetMetadata("Private") == "True")
				CopyLocal = true;
			if (item.GetMetadata("SpecificVersion") == "True")
				SpecificVersion = true;
			if (!String.IsNullOrEmpty(item.Condition))
				this.Condition = item.Condition;
			if (RefType == "ProjectReference")
				this.FromProjectReference(item, Check.NotNull(fnTranslate));
			else if (RefType == "Reference")
				this.FromFileReference(item, Check.NotNull(fnTranslate));
			else
				throw new ApplicationException("Unkown reference type " + RefType);
		}
开发者ID:hivie7510,项目名称:csharptest-net,代码行数:16,代码来源:ProjectRef.cs


示例20: Initialize

        public void Initialize()
        {
            // Create some items and place them in a dictionary
            // Add some include information so that when we check the final 
            // item spec we can verify that the item was recreated properly
            buildItem1.Include = "TestInclude1";
            buildItem2.Include = "TestInclude2";

            BuildItem[] taskItems = new BuildItem[2];
            taskItems[0] = buildItem1;
            taskItems[1] = buildItem2;

            Dictionary<object, object> dictionary = new Dictionary<object, object>();
            dictionary.Add("TaskItems", taskItems);
            resultNoOutputs = new BuildResult(null, new Hashtable(StringComparer.OrdinalIgnoreCase), true, 0, 1, 2, true, string.Empty, string.Empty, 0, 0, 0);
            resultWithOutputs = new BuildResult(dictionary, new Hashtable(StringComparer.OrdinalIgnoreCase), true, 0, 1, 2, true, string.Empty, string.Empty, 0, 0, 0);
        }
开发者ID:nikson,项目名称:msbuild,代码行数:17,代码来源:BuildResult_Tests.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# BuildEngine.BuildItemGroup类代码示例发布时间:2022-05-26
下一篇:
C# BackEnd.BuildRequestEntry类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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