本文整理汇总了C#中NuGet.Frameworks.NuGetFramework.GetTwoDigitShortFolderName方法的典型用法代码示例。如果您正苦于以下问题:C# NuGetFramework.GetTwoDigitShortFolderName方法的具体用法?C# NuGetFramework.GetTwoDigitShortFolderName怎么用?C# NuGetFramework.GetTwoDigitShortFolderName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NuGet.Frameworks.NuGetFramework
的用法示例。
在下文中一共展示了NuGetFramework.GetTwoDigitShortFolderName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeDefaultTargetFrameworkDefine
private static string MakeDefaultTargetFrameworkDefine(NuGetFramework targetFramework)
{
var shortName = targetFramework.GetTwoDigitShortFolderName();
if (targetFramework.IsPCL)
{
return null;
}
var candidateName = shortName.ToUpperInvariant();
// Replace '-', '.', and '+' in the candidate name with '_' because TFMs with profiles use those (like "net40-client")
// and we want them representable as defines (i.e. "NET40_CLIENT")
candidateName = candidateName.Replace('-', '_').Replace('+', '_').Replace('.', '_');
// We require the following from our Target Framework Define names
// Starts with A-Z or _
// Contains only A-Z, 0-9 and _
if (!string.IsNullOrEmpty(candidateName) &&
(char.IsLetter(candidateName[0]) || candidateName[0] == '_') &&
candidateName.All(c => Char.IsLetterOrDigit(c) || c == '_'))
{
return candidateName;
}
return null;
}
示例2: GetOutputPaths
public static OutputPaths GetOutputPaths(
Project project,
NuGetFramework framework,
string runtimeIdentifier,
string configuration,
string solutionRootPath,
string buildBasePath,
string outputPath)
{
string resolvedBuildBasePath;
if (string.IsNullOrEmpty(buildBasePath))
{
resolvedBuildBasePath = project.ProjectDirectory;
}
else
{
if (string.IsNullOrEmpty(solutionRootPath))
{
resolvedBuildBasePath = Path.Combine(buildBasePath, project.Name);
}
else
{
resolvedBuildBasePath = project.ProjectDirectory.Replace(solutionRootPath, buildBasePath);
}
}
var compilationOutputPath = PathUtility.EnsureTrailingSlash(Path.Combine(resolvedBuildBasePath,
BinDirectoryName,
configuration,
framework.GetShortFolderName()));
string runtimeOutputPath = null;
if (string.IsNullOrEmpty(outputPath))
{
if (!string.IsNullOrEmpty(runtimeIdentifier))
{
runtimeOutputPath = PathUtility.EnsureTrailingSlash(Path.Combine(compilationOutputPath, runtimeIdentifier));
}
else
{
// "Runtime" assets (i.e. the deps file) will be dropped to the compilation output path, because
// we are building a RID-less target.
runtimeOutputPath = compilationOutputPath;
}
}
else
{
runtimeOutputPath = PathUtility.EnsureTrailingSlash(Path.GetFullPath(outputPath));
}
var intermediateOutputPath = PathUtility.EnsureTrailingSlash(Path.Combine(
resolvedBuildBasePath,
ObjDirectoryName,
configuration,
framework.GetTwoDigitShortFolderName()));
var compilationFiles = new CompilationOutputFiles(compilationOutputPath, project, configuration, framework);
RuntimeOutputFiles runtimeFiles = null;
if (runtimeOutputPath != null)
{
runtimeFiles = new RuntimeOutputFiles(runtimeOutputPath, project, configuration, framework);
}
return new OutputPaths(intermediateOutputPath, compilationOutputPath, runtimeOutputPath, compilationFiles, runtimeFiles);
}