-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
After my devops pipeline started pulling in SDK 6.0.200 for the VS build task, Blazor projects now fail compilation with source generator errors.
To reproduce, created basic Blazor server project from VS template, added a call to OnAfterRenderAsync in a razor cs code behind file, attempted to build in a Windows 2022 Azure pipeline VS build task.
Following error encountered:
##[warning]CSC(0,0): Warning CS8032: An instance of analyzer Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator cannot be created from C:\hostedtoolcache\windows\dotnet\sdk\6.0.200\Sdks\Microsoft.NET.Sdk.Razor\source-generators\Microsoft.NET.Sdk.Razor.SourceGenerators.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
CSC : warning CS8032: An instance of analyzer Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator cannot be created from C:\hostedtoolcache\windows\dotnet\sdk\6.0.200\Sdks\Microsoft.NET.Sdk.Razor\source-generators\Microsoft.NET.Sdk.Razor.SourceGenerators.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.. [D:\a\1\s\BlazorApp1\BlazorApp1.csproj]
##[error]BlazorApp1\Pages\Counter.razor.cs(12,39): Error CS0115: 'Counter.OnAfterRenderAsync(bool)': no suitable method found to override
Build works fine using SDK 6.0.102