本文整理汇总了C#中ITaskItem.GetPackageDirectory方法的典型用法代码示例。如果您正苦于以下问题:C# ITaskItem.GetPackageDirectory方法的具体用法?C# ITaskItem.GetPackageDirectory怎么用?C# ITaskItem.GetPackageDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITaskItem
的用法示例。
在下文中一共展示了ITaskItem.GetPackageDirectory方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConvertToPackageFile
private static ITaskItem ConvertToPackageFile(ITaskItem output)
{
var fileName = output.ItemSpec;
var frameworkNameMoniker = output.GetTargetFrameworkMoniker();
var packageDirectory = output.GetPackageDirectory();
var targetFramework = frameworkNameMoniker.GetShortFrameworkName();
var metadata = output.CloneCustomMetadata();
metadata[Metadata.TargetFramework] = targetFramework;
metadata[Metadata.PackageDirectory] = packageDirectory.ToString();
metadata[Metadata.FileTarget] = packageDirectory.Combine(targetFramework, Path.GetFileName(fileName));
return new TaskItem(fileName, metadata);
}
示例2: 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;
}
示例3: ConvertToPackageFile
private static ITaskItem ConvertToPackageFile(ITaskItem output)
{
var fileName = output.ItemSpec;
var targetPath = output.GetMetadata("TargetPath");
targetPath = string.IsNullOrEmpty(targetPath) ? Path.GetFileName(fileName) : targetPath;
var frameworkNameMoniker = output.GetTargetFrameworkMoniker();
var packageDirectory = output.GetPackageDirectory();
var targetSubdirectory = output.GetTargetSubdirectory();
var targetFramework = packageDirectory == PackageDirectory.Analyzers
? frameworkNameMoniker.GetAnalyzersFrameworkName()
: frameworkNameMoniker.GetShortFrameworkName();
var metadata = output.CloneCustomMetadata();
metadata[Metadata.TargetFramework] = targetFramework;
metadata[Metadata.PackageDirectory] = packageDirectory.ToString();
metadata[Metadata.TargetSubdirectory] = targetSubdirectory;
metadata[Metadata.FileTarget] = packageDirectory.Combine(targetFramework, targetSubdirectory, targetPath);
return new TaskItem(fileName, metadata);
}