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


C# ITaskItem.SetMetadata方法代码示例

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


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

示例1: CheckIfSourceNeedsCompilation

 private void CheckIfSourceNeedsCompilation(ConcurrentQueue<ITaskItem> sourcesNeedingCompilationList, bool allOutputFilesExist, ITaskItem source)
 {
     if (!this.tlogAvailable || (this.outputFileGroup == null))
     {
         source.SetMetadata("_trackerCompileReason", "Tracking_SourceWillBeCompiledAsNoTrackingLog");
         sourcesNeedingCompilationList.Enqueue(source);
     }
     else if (!this.useMinimalRebuildOptimization && !allOutputFilesExist)
     {
         source.SetMetadata("_trackerCompileReason", "Tracking_SourceOutputsNotAvailable");
         sourcesNeedingCompilationList.Enqueue(source);
     }
     else if (!this.IsUpToDate(source))
     {
         if (string.IsNullOrEmpty(source.GetMetadata("_trackerCompileReason")))
         {
             source.SetMetadata("_trackerCompileReason", "Tracking_SourceWillBeCompiled");
         }
         sourcesNeedingCompilationList.Enqueue(source);
     }
     else if (!this.useMinimalRebuildOptimization && (this.outputNewestTime == DateTime.MinValue))
     {
         source.SetMetadata("_trackerCompileReason", "Tracking_SourceNotInTrackingLog");
         sourcesNeedingCompilationList.Enqueue(source);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:CanonicalTrackedInputFiles.cs

示例2: ResolvedReference

		public ResolvedReference (ITaskItem item, AssemblyName asm_name, bool copy_local, SearchPath search_path,
				string original_item_spec)
		{
			this.TaskItem = item;
			AssemblyName = asm_name;
			CopyLocal = copy_local;
			IsPrimary = true;
			FoundInSearchPath = search_path;

			TaskItem.SetMetadata ("OriginalItemSpec", original_item_spec);
			TaskItem.SetMetadata ("ResolvedFrom", FoundInSearchPathToString ());
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:12,代码来源:ResolvedReference.cs

示例3: CopyMetadataTo

 public static void CopyMetadataTo(this ITaskItem source, ITaskItem destination, string prefix)
 {
     foreach (string key in source.CloneCustomMetadata().Keys.OfType<string>())
     {
         destination.SetMetadata(String.Concat(prefix, key), source.GetMetadata(key));
     }
 }
开发者ID:automatonic,项目名称:exult,代码行数:7,代码来源:TaskItemExtensions.cs

示例4: TestCloneCustomMetadata

		public void TestCloneCustomMetadata ()
		{
			item = new TaskItem ();
			item.SetMetadata ("AAA", "111");
			item.SetMetadata ("aaa", "222");
			item.SetMetadata ("BBB", "111");

			string [] metakeys = new string [] { "aaa", "BBB" };
			IDictionary meta = item.CloneCustomMetadata ();

			Assert.IsTrue (CompareStringCollections (meta.Keys, metakeys), "A1");
			metakeys [0] = "aAa";
			Assert.IsTrue (CompareStringCollections (meta.Keys, metakeys), "A2");
			Assert.AreEqual ("222", meta ["aaa"], "A3");
			Assert.AreEqual ("222", meta ["AAA"], "A4");
			Assert.AreEqual ("222", meta ["aAa"], "A5");
			Assert.AreEqual ("111", meta ["BbB"], "A5");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:18,代码来源:TaskItemTest.cs

示例5: ComputeLocalizedResource

        private ITaskItem ComputeLocalizedResource(ITaskItem xlf)
        {
            var resxName = xlf.GetMetadata("FileName");
            var resxFileName = resxName + ".resx";
            var resxPath = Path.Combine(LocalizedResxRoot, resxFileName);

            var resxItem = new TaskItem(resxPath);
            resxItem.SetMetadata(NeutralResxMetadata, xlf.GetMetadata(NeutralResxMetadata));
            resxItem.SetMetadata(ParentXlfMetadata, xlf.ItemSpec);
            resxItem.SetMetadata(ComputedCultureCodeMetadata, xlf.GetMetadata(ComputedCultureCodeMetadata));
            resxItem.SetMetadata(LogicalNameMetadata, $"{AssemblyName}.{resxName}.resources");

            xlf.SetMetadata(ChildResxMetadata, resxPath);

            return resxItem;
        }
开发者ID:cdmihai,项目名称:msbuild,代码行数:16,代码来源:EmitLocalizedResources.cs

示例6: SetPackageDirectory

        private ITaskItem SetPackageDirectory(ITaskItem taskItem)
        {
            PackageDirectory targetPackageDirectory;
            string targetDirectoryPath;
            taskItem.GetTargetPackageDirectory(out targetPackageDirectory, out targetDirectoryPath);

            var packageDirectory = taskItem.GetPackageDirectory(targetPackageDirectory);

            if (packageDirectory != targetPackageDirectory)
            {
                Log.LogError($"File '{taskItem.ItemSpec}' has unexpected PackageDirectory metadata. Expected '{targetPackageDirectory}', actual '{packageDirectory}'.");
            }

            taskItem.SetMetadata(Metadata.PackageDirectory, targetPackageDirectory.ToString());
            return taskItem;

        }
开发者ID:kovalikp,项目名称:nuproj,代码行数:17,代码来源:AssignPackageDirectory.cs

示例7: GetItemCulture

 private static CultureInfo GetItemCulture(ITaskItem item)
 {
     string metadata = item.GetMetadata("Culture");
     if (string.IsNullOrEmpty(metadata))
     {
         string[] pathSegments = PathUtil.GetPathSegments(item.ItemSpec);
         metadata = (pathSegments.Length > 1) ? pathSegments[pathSegments.Length - 2] : null;
         item.SetMetadata("Culture", metadata);
     }
     return new CultureInfo(metadata);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:ResolveManifestFiles.cs

示例8: TestSetMetadata3

		public void TestSetMetadata3 ()
		{
			item = new TaskItem ("itemSpec");
			item.SetMetadata ("name", null);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:5,代码来源:TaskItemTest.cs

示例9: TestSetReservedMetadata

		public void TestSetReservedMetadata ()
		{
			item = new TaskItem ("lalala");
			item.SetMetadata ("Identity", "some value");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:5,代码来源:TaskItemTest.cs

示例10: ProcessInclude

		private void ProcessInclude (ITaskItem include_item, Dictionary <string, bool> excludedItems,
				List <ITaskItem> includedItems)
		{
			string[] separatedPath;
			FileInfo[] fileInfo;

			string name = include_item.ItemSpec;
			if (!HasWildcard (name)) {
				if (!excludedItems.ContainsKey (Path.GetFullPath (name))) {
					includedItems.Add (include_item);
					if (projectFile != null)
						include_item.SetMetadata ("DefiningProjectFullPath", projectFile);
				}
			} else {
				if (name.Split (Path.DirectorySeparatorChar).Length > name.Split (Path.AltDirectorySeparatorChar).Length) {
					separatedPath = name.Split (new char [] {Path.DirectorySeparatorChar},
							StringSplitOptions.RemoveEmptyEntries);
				} else {
					separatedPath = name.Split (new char [] {Path.AltDirectorySeparatorChar},
							StringSplitOptions.RemoveEmptyEntries);
				}
				if (separatedPath.Length == 1 && separatedPath [0] == String.Empty)
					return;

				int offset = 0;
				string full_path;
				if (Path.IsPathRooted (name)) {
					// The path may start with a root indicator, but at the same time can
					// contain relative paths inbetween
					full_path = Path.GetFullPath (name);
					baseDirectory = new DirectoryInfo (Path.GetPathRoot (name));
					if (IsRunningOnWindows)
						// skip the "drive:"
						offset = 1;
				} else {
					full_path = Path.GetFullPath (Path.Combine (Environment.CurrentDirectory, name));
				}

				fileInfo = ParseIncludeExclude (separatedPath, offset, baseDirectory);

				int wildcard_offset = full_path.IndexOf ("**");
				foreach (FileInfo fi in fileInfo) {
					string itemName = fi.FullName;
					if (!Path.IsPathRooted (name) && itemName.Length > baseDirectory.FullName.Length && itemName.StartsWith (baseDirectory.FullName))
						itemName = itemName.Substring (baseDirectory.FullName.Length + 1);

					if (!excludedItems.ContainsKey (itemName) &&  !excludedItems.ContainsKey (Path.GetFullPath (itemName))) {
						TaskItem item = new TaskItem (include_item);
						item.ItemSpec = itemName;

						if (wildcard_offset >= 0) {
							string rec_dir = Path.GetDirectoryName (fi.FullName.Substring (wildcard_offset));
							if (rec_dir.Length > 0)
								rec_dir += Path.DirectorySeparatorChar;
							item.SetMetadata ("RecursiveDir", rec_dir);
						}
						if (projectFile != null)
							item.SetMetadata ("DefiningProjectFullPath", projectFile);
						includedItems.Add (item);
					}
				}
			}
		}
开发者ID:Profit0004,项目名称:mono,代码行数:63,代码来源:DirectoryScanner.cs

示例11: TestSetMetadata2

		public void TestSetMetadata2 ()
		{
			item = new TaskItem ("itemSpec");
			item.SetMetadata (null, "value");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:5,代码来源:TaskItemTest.cs

示例12: SetBuildInProjectAndReferenceOutputAssemblyMetadata

 internal static void SetBuildInProjectAndReferenceOutputAssemblyMetadata(bool onlyReferenceAndBuildProjectsEnabledInSolutionConfiguration, ITaskItem resolvedProjectWithConfiguration, XmlElement projectConfigurationElement)
 {
     if (((projectConfigurationElement != null) && (resolvedProjectWithConfiguration != null)) && onlyReferenceAndBuildProjectsEnabledInSolutionConfiguration)
     {
         bool result = false;
         if (bool.TryParse(projectConfigurationElement.GetAttribute("BuildProjectInSolution"), out result) && !result)
         {
             string metadata = resolvedProjectWithConfiguration.GetMetadata("BuildReference");
             string str3 = resolvedProjectWithConfiguration.GetMetadata("ReferenceOutputAssembly");
             if (metadata.Length == 0)
             {
                 resolvedProjectWithConfiguration.SetMetadata("BuildReference", "false");
             }
             if (str3.Length == 0)
             {
                 resolvedProjectWithConfiguration.SetMetadata("ReferenceOutputAssembly", "false");
             }
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:20,代码来源:AssignProjectConfiguration.cs

示例13: CopyMetadataTo

 /// <summary>
 /// 
 /// </summary>
 /// <param name="destinationItem"></param>
 public void CopyMetadataTo(ITaskItem destinationItem)
 {
     foreach (string metaKey in metaData.Keys)
     {
         destinationItem.SetMetadata(metaKey, metaData[metaKey]);
     }
 }
开发者ID:trippleflux,项目名称:jezatools,代码行数:11,代码来源:XmlNodeTaskItem.cs

示例14: SetCopyLocal

		void SetCopyLocal (ITaskItem item, string copy_local)
		{
			item.SetMetadata ("CopyLocal", copy_local);

			// Assumed to be valid value
			if (Boolean.Parse (copy_local))
				tempCopyLocalFiles.AddUniqueFile (item);
		}
开发者ID:afaerber,项目名称:mono,代码行数:8,代码来源:ResolveAssemblyReference.cs

示例15: PreparePackage

 /// <summary>
 /// Prepares a single .nuspec file for packaging
 /// </summary>
 /// <param name="specItem">
 /// The .nuspec file to prepare
 /// </param>
 private void PreparePackage(ITaskItem specItem)
 {
     // parse the .nuspec file
     // extract elements without namespaces to avoid
     // issues with multiple .nuspec versions
     var specPath = specItem.GetMetadata("FullPath");
     var specDoc = XDocument.Load(specPath);
     var fileElems = specDoc
        .Root
        .Elements()
        .Where(e => e.Name.LocalName == "files")
        .SelectMany(e => e.Elements())
        .Where(e => e.Attribute("src") != null);
     // construct the path to the NuGet package to build
     var pkgID = GetPackageID(specDoc);
     var pkgVersion = GetPackageVersion(specItem, specDoc);
     var pkgFile = this.VersionFileName ?
        String.Format("{0}.{1}.nupkg", pkgID, pkgVersion) :
        String.Format("{0}.nupkg", pkgID);
     var pkgPath = Path.Combine(this.OutputPath, pkgFile);
     // add custom metadata to the .nuspec build item
     specItem.SetMetadata("NuPackagePath", pkgPath);
     if (pkgVersion != null)
         specItem.SetMetadata("NuPackageVersion", pkgVersion.ToString());
     // add the list of files referenced by the .nuspec file
     // to the dependency list for the build, and add the
     // package file to the target list
     this.sourceList.AddRange(
        fileElems.Select(
           e => new TaskItem(
              Path.Combine(
                 specItem.GetMetadata("RootDir"),
                 specItem.GetMetadata("Directory"),
                 e.Attribute("src").Value
              )
           )
        )
     );
     this.targetList.Add(new TaskItem(pkgPath));
 }
开发者ID:bspell1,项目名称:NuBuild,代码行数:46,代码来源:NuPrepare.cs


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