Support language version based on schema
This commit is contained in:
parent
b50ae8bbeb
commit
f1f1db0d8e
1 changed files with 12 additions and 1 deletions
|
@ -114,7 +114,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Csc
|
|||
|
||||
if (options.LanguageVersion != null)
|
||||
{
|
||||
commonArgs.Add($"-langversion:{options.LanguageVersion}");
|
||||
commonArgs.Add($"-langversion:{GetLanguageVersion(options.LanguageVersion)}");
|
||||
}
|
||||
|
||||
if (options.Platform != null)
|
||||
|
@ -159,6 +159,17 @@ namespace Microsoft.DotNet.Tools.Compiler.Csc
|
|||
return commonArgs;
|
||||
}
|
||||
|
||||
private static string GetLanguageVersion(string languageVersion)
|
||||
{
|
||||
// project.json supports the enum that the roslyn APIs expose
|
||||
if (languageVersion?.StartsWith("csharp", StringComparison.OrdinalIgnoreCase) == true)
|
||||
{
|
||||
// We'll be left with the number csharp6 = 6
|
||||
return languageVersion.Substring("csharp".Length);
|
||||
}
|
||||
return languageVersion;
|
||||
}
|
||||
|
||||
private static Command RunCsc(string cscArgs)
|
||||
{
|
||||
// Locate CoreRun
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue