Installing 3.0 Preview 3 SDK broke build for 3.0 Preview 2 Razor Components app
See original GitHub issueI created an app with the Preview 2 SDK (released bits). Today I installed the latest available Preview 3 bits (https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/3.0.1xx/dotnet-sdk-latest-win-x64.exe) and now I get build errors for the Razor Components cshtml files. I’m not sure if this is expected, since there have been a lot of changes in this area between Preview 2 and Preview 3.
Installation reported these bits, for context:
The following were installed at: ‘C:\Program Files\dotnet’ • .NET Core SDK 3.0.100-preview3-010343 • .NET Core Runtime 3.0.0-preview3-27421-7 • ASP.NET Core Runtime 3.0.0-preview3-19121-17 • .NET Core Windows Desktop Runtime 3.0.0-preview3-27420-40
The build errors I get are like this one (note, it’s in a generated file for the .cshtml):
obj\Debug\netstandard2.0\Razor\Pages\Counter.cshtml.g.cs(35,48): error CS0234: The type or namespace name ‘EventCallback’ does not exist in the namespace ‘Microsoft.AspNetCore.Components’ (are you missing an assembly reference?) [D:\src\AppBuilding\src\OrderSite.App\OrderSite.App.csproj]
The generated line of code is:
builder.AddAttribute(7, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this, IncrementCount));
With the Preview 2 SDK, the generated line of code was:
builder.AddAttribute(7, "onclick", Microsoft.AspNetCore.Components.BindMethods.GetEventHandlerValue<Microsoft.AspNetCore.Components.UIMouseEventArgs>(IncrementCount));
Note: if I create a new Razor Components project with the Preview 3 SDK installed, it builds fine. The project created is very different from the Preview 2 template however.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (3 by maintainers)
This is expected for now.
We’re still working on the compiler and there will be changes between releases. We don’t expect the runtime from preview2 to be compatible with a nightly build of the SDK.
@DefenceAquireSustain I had the same problem. but I read this news and solved it.