-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Verify that Razor compiler honors global usings when generating code for .cshtml & .razor files #34217
Comments
-Depends on dotnet/sdk#18459 flowing to dotnet/aspnetcore repo before we can merge this - There's a couple of places we could remove usings from .razor files but need to verify the global usings flow into Razor compiler (#34217) - Reordered usings in some places to ensure they get emitted in alphabetical order (modulo System.* & Microsoft.* coming before any others)
-Depends on dotnet/sdk#18459 flowing to dotnet/aspnetcore repo before we can merge this - There's a couple of places we could remove usings from .razor files but need to verify the global usings flow into Razor compiler (#34217) - Reordered usings in some places to ensure they get emitted in alphabetical order (modulo System.* & Microsoft.* coming before any others)
-Depends on dotnet/sdk#18459 flowing to dotnet/aspnetcore repo before we can merge this - There's a couple of places we could remove usings from .razor files but need to verify the global usings flow into Razor compiler (#34217) - Reordered usings in some places to ensure they get emitted in alphabetical order (modulo System.* & Microsoft.* coming before any others)
At the moment, the set of imports that we include via the SDK:
Mostly overlaps with the set that we include by default in the generated Razor code. Lines 17 to 21 in 19f1321
So we can already remove those imports. Razor currently uses the
will fail to compile due to issues resolving types in the Shared namespace.
|
Closing in favor of dotnet/razor#7539. |
With C# 10 introducing support for global usings declarations and the SDK now implicitly adding global usings for projects targeting .NET 6 we need to verify that the Razor compiler honors any global usings (whether set via the SDK or in the project) in the code it generates.
We expect this will "just work" so this issue is to ensure we verify that.
Assuming this is verified we can update the project templates to not explicitly add usings in .cshtml/.razor files if they're already added by the SDK.
@captainsafia @pranavkm
The text was updated successfully, but these errors were encountered: