-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add RazorLangVersion 5.0 #23408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add RazorLangVersion 5.0 #23408
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -625,28 +625,26 @@ public async Task Build_WithoutServer_ErrorDuringBuild_DisplaysErrorInMsBuildOut | |
| { | ||
| var result = await DotnetMSBuild( | ||
| "Build", | ||
| "/p:UseRazorBuildServer=false /p:RazorLangVersion=5.0", | ||
| "/p:UseRazorBuildServer=false /p:RazorLangVersion=99.0", | ||
| suppressBuildServer: true); | ||
|
|
||
| Assert.BuildFailed(result); | ||
| Assert.BuildOutputContainsLine( | ||
| result, | ||
| $"Invalid option 5.0 for Razor language version --version; must be Latest or a valid version in range 1.0 to 3.0."); | ||
| $"Invalid option 99.0 for Razor language version --version; must be Latest or a valid version in range 1.0 to 5.0."); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This is a confusing statement indicating 4.0 might be valid. Could we rephrase this somehow?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestions? I would note that none of the point values are supported. (e.g. 3.1 is not valid).
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it is easy to do, we could just list all the possible supported values. Just like how dotnet lists all the available SDKs
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's what the compiler does: Error CS1617 Invalid option '9.0' for /langversion. Use '/langversion:?' to list supported values It's not really easy to find this. I'm kinda tempted to leave these be. AFAIK, nobody configures these. Plus the language versions are precariously tied to the runtime version that setting this is always going to get you in trouble. |
||
|
|
||
| // Compilation failed without creating the views assembly | ||
| Assert.FileExists(result, IntermediateOutputPath, "SimpleMvc.dll"); | ||
| Assert.FileDoesNotExist(result, IntermediateOutputPath, "SimpleMvc.Views.dll"); | ||
| } | ||
|
|
||
| [Fact(Skip = "Default C# version is 7.3 for netcoreapp3.1 and later https://github.com/dotnet/aspnetcore/issues/13930")] | ||
| [Fact] | ||
| [InitializeTestProject("SimpleMvc")] | ||
| public async Task Build_ImplicitCSharp8_NullableEnforcement_WarningsDuringBuild_NoBuildServer() | ||
| { | ||
| var result = await DotnetMSBuild( | ||
| "Build", | ||
| // Remove /p:LangVersion=Default once we've picked up a compiler that supports .NET 5.0. | ||
| // Tracked by https://github.com/dotnet/aspnetcore/issues/13304 | ||
| "/p:Nullable=enable /p:LangVersion=Default", | ||
| "/p:Nullable=enable", | ||
| suppressBuildServer: true); | ||
| var indexFilePath = Path.Combine(RazorIntermediateOutputPath, "Views", "Home", "Index.cshtml.g.cs"); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to add this equivalent to the tooling repo too: https://github.com/dotnet/aspnetcore-tooling/blob/671d0792fb3fb587766a5800fafb0eee2d8f43cd/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/FallbackRazorConfiguration.cs#L37-L39