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


C# BuildItemGroup.AddNewItem方法代码示例

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


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

示例1: GenerateTestItems

        /// <summary>
        /// Generate a hashtable of items by type with a bunch of sample items, so that we can exercise
        /// ItemExpander.ItemizeItemVector.
        /// </summary>
        /// <returns></returns>
        /// <owner>RGoel</owner>
        private Hashtable GenerateTestItems()
        {
            Hashtable itemGroupsByType = new Hashtable(StringComparer.OrdinalIgnoreCase);

            // Set up our item group programmatically.
            BuildItemGroup itemGroup = new BuildItemGroup();
            itemGroupsByType["Compile"] = itemGroup;
            BuildItem a = itemGroup.AddNewItem("Compile", "a.cs");
            a.SetMetadata("WarningLevel", "4");
            BuildItem b = itemGroup.AddNewItem("Compile", "b.cs");
            b.SetMetadata("WarningLevel", "3");

            BuildItemGroup itemGroup2 = new BuildItemGroup();
            itemGroupsByType["Resource"] = itemGroup2;
            BuildItem c = itemGroup2.AddNewItem("Resource", "c.resx");

            return itemGroupsByType;
        }
开发者ID:nikson,项目名称:msbuild,代码行数:24,代码来源:ItemExpander_Tests.cs

示例2: SecondaryItemNotShadowedByPrimaryItem

        public void SecondaryItemNotShadowedByPrimaryItem()
        {
            BuildItemGroup group1 = new BuildItemGroup();
            group1.AddNewItem("i1", "a1");
            Hashtable table1 = new Hashtable(StringComparer.OrdinalIgnoreCase);
            table1.Add("i1", group1);
            Lookup lookup = LookupHelpers.CreateLookup(table1);

            lookup.EnterScope();

            // Should return item from the secondary table.
            Assertion.AssertEquals("a1", lookup.GetItems("i1")[0].FinalItemSpec);
        }
开发者ID:nikson,项目名称:msbuild,代码行数:13,代码来源:Lookup_Tests.cs

示例3: SetupMembers

        private void SetupMembers()
        {
            pg1 = new BuildPropertyGroup();
            pg1.SetProperty("foo", "bar");
            pg1.SetProperty("abc", "true");
            pg1.SetProperty("Unit", "inches");

            pg2 = new BuildPropertyGroup();
            pg2.SetProperty("foo", "bar");
            pg2.SetProperty("abc", "true");

            pg3 = new BuildPropertyGroup();

            // These Choose objects are only suitable for
            // holding a place in the GroupingCollection.
            choose1 = new Choose();
            choose2 = new Choose();
            choose3 = new Choose();

            ig1 = new BuildItemGroup();
            ig1.AddNewItem("x", "x1");
            ig1.AddNewItem("x", "x2");
            ig1.AddNewItem("y", "y1");
            ig1.AddNewItem("y", "y2");
            ig1.AddNewItem("y", "y3");
            ig1.AddNewItem("y", "y4");

            ig2 = new BuildItemGroup();
            ig2.AddNewItem("jacksonfive", "germaine");
            ig2.AddNewItem("jacksonfive", "tito");
            ig2.AddNewItem("jacksonfive", "michael");
            ig2.AddNewItem("jacksonfive", "latoya");
            ig2.AddNewItem("jacksonfive", "janet");

            ig3 = new BuildItemGroup();
        }
开发者ID:nikson,项目名称:msbuild,代码行数:36,代码来源:GroupingCollection_Tests.cs

示例4: TestAddNewItem1

		public void TestAddNewItem1 ()
		{
			string name = "name";
			string include = "a;b;c";
			
			BuildItemGroup big = new BuildItemGroup ();
			BuildItem bi = big.AddNewItem (name, include);

			Assert.AreEqual (String.Empty, bi.Condition, "A1");
			Assert.AreEqual (String.Empty, bi.Exclude, "A2");
			Assert.AreEqual (include, bi.FinalItemSpec, "A3");
			Assert.AreEqual (include, bi.Include, "A4");
			Assert.IsFalse (bi.IsImported, "A5");
			Assert.AreEqual (name, bi.Name, "A6");
			Assert.AreEqual (1, big.Count, "A7");
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:16,代码来源:BuildItemGroupTest.cs

示例5: InitiallyNoItemsInBucketOfTypesInItemNames

        public void InitiallyNoItemsInBucketOfTypesInItemNames()
        {
            // This bucket is for items of type "i"
            string[] itemNames = new string[] { "i" };

            // There are items of type "i" and "j" available in the project, though
            BuildItemGroup group1 = new BuildItemGroup();
            BuildItemGroup group2 = new BuildItemGroup();
            group1.AddNewItem("i", "i1");
            group2.AddNewItem("j", "j1");
            Hashtable items = new Hashtable(StringComparer.OrdinalIgnoreCase);
            items.Add("i", group1);
            items.Add("j", group2);
            Lookup lookup = LookupHelpers.CreateLookup(items);

            ItemBucket bucket = new ItemBucket(itemNames, new Dictionary<string, string>(), lookup, 0);

            // No items of type i
            Assertion.AssertEquals(0, bucket.Lookup.GetItems("i1").Count);
            // Items of type j, however, are visible
            Assertion.AssertEquals(1, bucket.Lookup.GetItems("j").Count);
        }
开发者ID:nikson,项目名称:msbuild,代码行数:22,代码来源:ItemBucket_Tests.cs

示例6: TestClone2

		public void TestClone2 ()
		{
			BuildItemGroup big = new BuildItemGroup ();
			big.AddNewItem ("a", "a");
			big.AddNewItem ("b", "a");

			BuildItemGroup big2 = big.Clone (true);
			BuildItem[] items = big2.ToArray ();

			Assert.AreEqual (2, big2.Count, "A1");

			Assert.AreEqual (String.Empty, items [0].Condition, "A2");
			Assert.AreEqual (String.Empty, items [0].Exclude, "A3");
			Assert.AreEqual ("a", items [0].FinalItemSpec, "A4");
			Assert.AreEqual ("a", items [0].Include, "A5");
			Assert.IsFalse (items [0].IsImported, "A6");
			Assert.AreEqual ("a", items [0].Name, "A7");
			
			Assert.AreEqual (String.Empty, items [1].Condition, "A8");
			Assert.AreEqual (String.Empty, items [1].Exclude, "A9");
			Assert.AreEqual ("a", items [1].FinalItemSpec, "A10");
			Assert.AreEqual ("a", items [1].Include, "A11");
			Assert.IsFalse (items [1].IsImported, "A12");
			Assert.AreEqual ("b", items [1].Name, "A13");
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:25,代码来源:BuildItemGroupTest.cs

示例7: AddFileToProject

 private static void AddFileToProject(BuildItemGroup itemGroup, CodeFile cf)
 {
     string include = cf.Filename.Replace("/", "\\");
     itemGroup.AddNewItem("Compile", include);
 }
开发者ID:pingvinen,项目名称:worm,代码行数:5,代码来源:Program.cs

示例8: IsImportedInMemoryBuildItemGroup

        public void IsImportedInMemoryBuildItemGroup()
        {
            BuildItemGroup group = new BuildItemGroup();
            group.AddNewItem("n", "i");

            Assertion.AssertEquals(false, group.IsImported);
        }
开发者ID:nikson,项目名称:msbuild,代码行数:7,代码来源:BuildItemGroup_Tests.cs

示例9: TestClear1

		public void TestClear1 ()
		{
			BuildItemGroup big = new BuildItemGroup ();
			big.AddNewItem ("a", "a");
			big.AddNewItem ("b", "a");

			Assert.AreEqual (2, big.Count, "A1");
			
			big.Clear ();

			Assert.AreEqual (0, big.Count, "A2");
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:12,代码来源:BuildItemGroupTest.cs

示例10: ValidUnqualifiedMetadataReference

        public void ValidUnqualifiedMetadataReference()
        {
            List<string> parameters = new List<string>();
            parameters.Add("@(File)");
            parameters.Add("%(Culture)");

            Hashtable itemsByType = new Hashtable(StringComparer.OrdinalIgnoreCase);

            BuildItemGroup items = new BuildItemGroup();
            itemsByType["FILE"] = items;

            BuildItem a = items.AddNewItem("File", "a.foo");
            BuildItem b = items.AddNewItem("File", "b.foo");
            a.SetMetadata("Culture", "fr-fr");
            b.SetMetadata("Culture", "en-en");

            BuildPropertyGroup properties = new BuildPropertyGroup();

            ArrayList buckets = BatchingEngine.PrepareBatchingBuckets(new XmlDocument().CreateElement("Foo"), parameters, CreateLookup(itemsByType, properties));
            Assertion.AssertEquals(2, buckets.Count);
        }
开发者ID:nikson,项目名称:msbuild,代码行数:21,代码来源:BatchingEngine_Tests.cs

示例11: Regress_Mutation_DuplicateBatchingBucketsAreFoldedTogether

        public void Regress_Mutation_DuplicateBatchingBucketsAreFoldedTogether()
        {
            List<string> parameters = new List<string>();
            parameters.Add("%(File.Culture)");

            Hashtable itemsByType = new Hashtable(StringComparer.OrdinalIgnoreCase);
            
            BuildItemGroup items = new BuildItemGroup();
            items.AddNewItem("File", "a.foo");
            items.AddNewItem("File", "b.foo"); // Need at least two items for this test case to ensure multiple buckets might be possible
            itemsByType["FILE"] = items;

            BuildPropertyGroup properties = new BuildPropertyGroup();

            ArrayList buckets = BatchingEngine.PrepareBatchingBuckets(new XmlDocument().CreateElement("Foo"), parameters, CreateLookup(itemsByType, properties));

            // If duplicate buckes have been folded correctly, then there will be exactly one bucket here
            // containing both a.foo and b.foo.
            Assertion.AssertEquals(1, buckets.Count);
        }
开发者ID:nikson,项目名称:msbuild,代码行数:20,代码来源:BatchingEngine_Tests.cs

示例12: TestRemoveItemAt3

		public void TestRemoveItemAt3 ()
		{
			BuildItemGroup big = new BuildItemGroup ();

			big.AddNewItem ("a", "b");
			big.AddNewItem ("b", "c");
			big.AddNewItem ("c", "d");

			big.RemoveItemAt (3);
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:10,代码来源:BuildItemGroupTest.cs

示例13: TestIndexer1

		public void TestIndexer1 ()
		{
			BuildItemGroup big = new BuildItemGroup ();
			big.AddNewItem ("a", "b");
			big.AddNewItem ("c", "d");

			Assert.AreEqual ("a", big [0].Name, "A1");
			Assert.AreEqual ("c", big [1].Name, "A2");
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:9,代码来源:BuildItemGroupTest.cs

示例14: AddFileToProject

 protected void AddFileToProject(BuildItemGroup items, string fullPath, string itemType)
 {
     items.AddNewItem(itemType, fullPath);
 }
开发者ID:jboyce,项目名称:LinqToSData,代码行数:4,代码来源:MSBuildDeploymentPackage.cs

示例15: TestGetEnumerator

		public void TestGetEnumerator ()
		{
			BuildItemGroup big = new BuildItemGroup ();
			big.AddNewItem ("a", "c");
			big.AddNewItem ("b", "d");

			IEnumerator e = big.GetEnumerator ();
			e.MoveNext ();
			Assert.AreEqual ("a", ((BuildItem) e.Current).Name, "A1");
			Assert.AreEqual ("c", ((BuildItem) e.Current).FinalItemSpec, "A2");
			e.MoveNext ();
			Assert.AreEqual ("b", ((BuildItem) e.Current).Name, "A3");
			Assert.AreEqual ("d", ((BuildItem) e.Current).FinalItemSpec, "A4");
			
			Assert.IsFalse (e.MoveNext ());
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:16,代码来源:BuildItemGroupTest.cs


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