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.

Describe the bug ‘dotnet test’ fails with this error, when building with Audit.Net included.

Removing any reference to audit.net causes the build to pass.

Error:

CSC : error CS8034: Unable to load Analyzer assembly C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.mvc.analyzers\2.2.0\analyzers\dotnet\cs\Microsoft.AspNetCore.Mvc.Analyzers.dll : Assembly with same name is already loaded

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>
  
  <PropertyGroup>
   <RunAnalyzersDuringBuild>false</RunAnalyzersDuringBuild>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Audit.WebApi.Core" Version="15.0.4" />
    <PackageReference Include="Audit.NET.AzureStorage" Version="15.0.4" />
    <PackageReference Include="Towel" Version="1.0.11-alpha" />
  </ItemGroup>

  </ItemGroup>

</Project>

dotnet version: 3.1.201

Additional context related to #275

Also see https://github.com/dotnet/websdk/issues/1203 Quote: "The Microsoft.AspNetCore.Mvc 2.2.0 package should not be used with 3.0 or later targeting projects. "

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ErikEJcommented, May 20, 2020

Thanks - works like a charm now!

and I could remove this:

   <PropertyGroup>
     <RunAnalyzersDuringBuild>false</RunAnalyzersDuringBuild>
  </PropertyGroup>

0reactions
thepirat000commented, May 19, 2020

This is fixed on version 15.2.2.

Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Error CS8034: failed to load Analyzer" ...
The analyzer should work just fine and Roslyn should ignore those bundled native libs (as they're not assembly references). Actual Behavior: CSC ...
Read more >
CS8034 - Visual Studio2022's NetAnalyzers.dll cannot ...
CS8034 - HRESULT:0x80131515 - Visual Studio2022's NetAnalyzers.dll and 5+ dll cannot load when opening MAUI solution. And i tried using Visual Studio ...
Read more >
CS8034 Unable to load Analyzer assembly
If so then take a look at the error message. It specifically states that that version is not compatible with your project.
Read more >
Building ASP.NET-Core 3.1 with .NET-Standard 2.0 ...
This builds and runs fine from Visual Studio (2019) but when I run dotnet build I get the following error: Build FAILED. CSC...
Read more >
Publishing blazor project with dotnet stops with warning ...
dotnet will report: warning CS8034: Microsoft.AspNetCore. ... If we haven't resolved this issue for you, please report a new problem. Yes, it works....
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