question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding Blazored.Modal package to project causes Microsoft.AspNetCore.Components.Analyzer to be loaded twice

See original GitHub issue

This appears to be down to the Sdk.props file at C:\Program Files\dotnet\sdk\3.1.101\Sdks\Microsoft.NET.Sdk.Web\Sdk pulling the code analyzer into the project but it also coming in via the dependencies within Blazored.Modal.

If <TreatWarningsAsErrors>true</TreatWarningsAsErrors> is set then this causes a build issue. We can <NoWarn>8034</NoWarn> to prevent the build issues, but I figured I’d bring it to your attention just in case you need to patch something your end.

Steps to reproduce:

  1. dotnet new blazorserver -n Example
  2. cd Example
  3. dotnet add package Blazored.Modal
  4. dotnet build
Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 173.45 ms for C:\Users\*********\RiderProjects\Example\Example.csproj.
CSC : warning CS8034: Unable to load Analyzer assembly C:\Users\*********\.nuget\packages\microsoft.aspnetcore.components.analyzers\3.1.0\analyzers\dotnet\cs\Microsoft.AspNetCore.Components.Analyzers.dll : Assembly with same name is already loaded [C:\Users\*********\RiderProjects\Example\Example.csproj]
CSC : warning CS8034: Unable to load Analyzer assembly C:\Users\*********\.nuget\packages\microsoft.aspnetcore.components.analyzers\3.1.0\analyzers\dotnet\cs\Microsoft.AspNetCore.Components.Analyzers.dll : Assembly with same name is already loaded [C:\Users\*********\RiderProjects\Example\Example.csproj]
  Example -> C:\Users\*********\RiderProjects\Example\bin\Debug\netcoreapp3.1\Example.dll
  Example -> C:\Users\*********\RiderProjects\Example\bin\Debug\netcoreapp3.1\Example.Views.dll

Build succeeded.

CSC : warning CS8034: Unable to load Analyzer assembly C:\Users\*********\.nuget\packages\microsoft.aspnetcore.components.analyzers\3.1.0\analyzers\dotnet\cs\Microsoft.AspNetCore.Components.Analyzers.dll : Assembly with same name is already loaded [C:\Users\*********\RiderProjects\Example\Example.csproj]
CSC : warning CS8034: Unable to load Analyzer assembly C:\Users\*********\.nuget\packages\microsoft.aspnetcore.components.analyzers\3.1.0\analyzers\dotnet\cs\Microsoft.AspNetCore.Components.Analyzers.dll : Assembly with same name is already loaded [C:\Users\*********\RiderProjects\Example\Example.csproj]
    2 Warning(s)
    0 Error(s)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
newmancodescommented, Feb 13, 2020

Already propagated and looks good to me. Thanks for the amazingly rapid response.

1reaction
chrissaintycommented, Feb 13, 2020

I’ve just updated the package, it seems I’d updated to 3.1.100 but not 3.1.101. It’s just been pushed to NuGet and should be available in the next half hour. Let me know if you’re still seeing an issue after the update.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Building an ASP.NET Core project that transitively ...
The analyzer adds important diagnosis for developers building a Blazor application, so we generally want it on by default. The Microsoft.
Read more >
why this error generated on blazor and how to solve it
I work on blazor app server side . i found my app stuck i don't kno why it ... viewer to check it...
Read more >
Build error with code analyzer after upgrading to .net core ...
The error appears to be in the web assembly (client) project. I can't see any duplicate Analyzers in that. However in the Server...
Read more >
Posts
This slight change of approach makes components written for the other hosting models ... We're going to start by adding some tests to...
Read more >
学习Blazor
Sample project that demonstrates how you can use the power of Blazor, ASP.NET Core, and gRPC to create a web application which can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found