Skip to content

Building a 5.0 app with 6.0 SDK in VS 2019 causes analyzers to fail to load #36552

Closed
@pranavkm

Description

@pranavkm

MVC and StartupAnalyzer are shipped as part of the SDK and target every version of .NET 3.1 onwards. These analyzers have been updated to reference Microsoft.CodeAnalysis versions 4.0.0.0 which isn't available on VS 2019. Consequently opening a 5.0 project with a 6.0 SDK results in a bunch of warnings:

1>CSC : warning CS8032: An instance of analyzer Microsoft.AspNetCore.Analyzers.StartupAnalyzer cannot be created from C:\Program Files\dotnet\sdk\6.0.100-rc.2.21464.10\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : warning CS8032: An instance of analyzer Microsoft.AspNetCore.Mvc.Analyzers.AttributesShouldNotBeAppliedToPageModelAnalyzer cannot be created from C:\Program Files\dotnet\sdk\6.0.100-rc.2.21464.10\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Mvc.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : warning CS8032: An instance of analyzer Microsoft.AspNetCore.Mvc.Analyzers.AvoidHtmlPartialAnalyzer cannot be created from C:\Program Files\dotnet\sdk\6.0.100-rc.2.21464.10\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Mvc.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : warning CS8032: An instance of analyzer Microsoft.AspNetCore.Mvc.Analyzers.TagHelpersInCodeBlocksAnalyzer cannot be created from C:\Program Files\dotnet\sdk\6.0.100-rc.2.21464.10\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Mvc.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : warning CS8032: An instance of analyzer Microsoft.AspNetCore.Mvc.Analyzers.TopLevelParameterNameAnalyzer cannot be created from C:\Program Files\dotnet\sdk\6.0.100-rc.2.21464.10\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Mvc.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : warning CS8032: An instance of analyzer Microsoft.AspNetCore.Components.Analyzers.ComponentParameterAnalyzer cannot be created from C:\Program Files\dotnet\sdk\6.0.100-rc.2.21464.10\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Components.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : warning CS8032: An instance of analyzer Microsoft.AspNetCore.Components.Analyzers.ComponentParameterUsageAnalyzer cannot be created from C:\Program Files\dotnet\sdk\6.0.100-rc.2.21464.10\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Components.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : warning CS8032: An instance of analyzer Microsoft.Extensions.Internal.ComponentInternalUsageDiagnosticAnalyzer cannot be created from C:\Program Files\dotnet\sdk\6.0.100-rc.2.21464.10\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Components.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : warning CS8032: An instance of analyzer Microsoft.AspNetCore.Analyzers.StartupAnalyzer cannot be created from C:\Program Files\dotnet\sdk\6.0.100-rc.2.21464.10\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : warning CS8032: An instance of analyzer Microsoft.AspNetCore.Mvc.Analyzers.AttributesShouldNotBeAppliedToPageModelAnalyzer cannot be created from C:\Program Files\dotnet\sdk\6.0.100-rc.2.21464.10\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Mvc.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : warning CS8032: An instance of analyzer Microsoft.AspNetCore.Mvc.Analyzers.AvoidHtmlPartialAnalyzer cannot be created from C:\Program Files\dotnet\sdk\6.0.100-rc.2.21464.10\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Mvc.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : warning CS8032: An instance of analyzer Microsoft.AspNetCore.Mvc.Analyzers.TagHelpersInCodeBlocksAnalyzer cannot be created from C:\Program Files\dotnet\sdk\6.0.100-rc.2.21464.10\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Mvc.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : warning CS8032: An instance of analyzer Microsoft.AspNetCore.Mvc.Analyzers.TopLevelParameterNameAnalyzer cannot be created from C:\Program Files\dotnet\sdk\6.0.100-rc.2.21464.10\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Mvc.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : warning CS8032: An instance of analyzer Microsoft.AspNetCore.Components.Analyzers.ComponentParameterAnalyzer cannot be created from C:\Program Files\dotnet\sdk\6.0.100-rc.2.21464.10\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Components.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : warning CS8032: An instance of analyzer Microsoft.AspNetCore.Components.Analyzers.ComponentParameterUsageAnalyzer cannot be created from C:\Program Files\dotnet\sdk\6.0.100-rc.2.21464.10\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Components.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : warning CS8032: An instance of analyzer Microsoft.Extensions.Internal.ComponentInternalUsageDiagnosticAnalyzer cannot be created from C:\Program Files\dotnet\sdk\6.0.100-rc.2.21464.10\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Components.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..

We should pin these to the the most recent version supported by VS2019.

Metadata

Metadata

Assignees

Labels

area-blazorIncludes: Blazor, Razor Componentsarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesbugThis issue describes a behavior which is not expected - a bug.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions