本文整理汇总了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 ());
}
示例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));
}
}
示例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");
}
示例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;
}
示例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;
}
示例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);
}
示例8: TestSetMetadata3
public void TestSetMetadata3 ()
{
item = new TaskItem ("itemSpec");
item.SetMetadata ("name", null);
}
示例9: TestSetReservedMetadata
public void TestSetReservedMetadata ()
{
item = new TaskItem ("lalala");
item.SetMetadata ("Identity", "some value");
}
示例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);
}
}
}
}
示例11: TestSetMetadata2
public void TestSetMetadata2 ()
{
item = new TaskItem ("itemSpec");
item.SetMetadata (null, "value");
}
示例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]);
}
}
示例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);
}
示例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));
}