Closed SteveSandersonMS closed 1 year ago
This is blocking aspnetcore's SDK update. https://github.com/dotnet/aspnetcore/pull/49034#issuecomment-1608571858. It's already been tracked down as a regression caused by https://github.com/dotnet/razor/pull/8857 and both https://github.com/dotnet/razor/pull/8871 and https://github.com/dotnet/razor/pull/8877 are proposed fixes. @jjonescz
Thanks for the extra info. Razor folks, please feel free to close this issue if it's duplicating something else that tracks this.
@surayya-MS why did you re-open this issue? Do you believe the fix here did not fix it?
Sorry, it was a mistake. Closing the issue.
In the latest .NET 8 SDKs, we seem to have lost support for
~
-prefixed URLs in.cshtml
files. Among other problems, this will break existing Blazor Server apps.Repro
global.json
or whatever you like to ensure thatdotnet --version
returns a v7 number.dotnet new blazorserver
). Run it and see that it works. If you check the HTML source, you'll see it contains<base href="/">
which is correct.global.json
). You can deletebin
/obj
if you want.<base href="~/">
which is incorrect (note the extra tilde which should have been resolved on the server).Further investigation
If you have a
.cshtml
file containing just the following:... then with .NET 7 it compiles as:
... whereas with .NET 8 it compiles as:
... and so it's clearly not resolving the
~
in thehref
attribute value.