.NET 8 version conflicts with Microsoft.CodeAnalysis.VisualBasic nuget package
We want to migrate out solution to .NET 8 and have a version conflict using ReportViewerCore.NETCore.
We discovered that ReportViewerCore.NETCore ships Microsoft.CodeAnalysis.VisualBasic 4.8.0-3 final as dependency. Is there a reason why CodeAnalyser is delivered as dependency? Normally CodeAnalyser should not be delivered as a dependency of a nuget package.
Removing the Microsoft.CodeAnalysis.VisualBasic from the output would solve our issue. We provide a PR for this change.
Microsoft.CodeAnalysis.VisualBasic is a Roslyn compiler for Visual Basic. Reporting Services / ReportViewer uses Visual Basic as a scripting language and this compiler is required for most of reports to work.
A typical ASP.NET Core project references package Microsoft.VisualStudio.Web.CodeGeneration.Design which transitively reference package Microsoft.CodeAnalysis.Common. For .NET 8 it requires version 4.8.0-3.final. To minimize dependency conflicts, ReportViewerCore also references version 4.8.0-3 final of Microsoft.CodeAnalysis.* packages.
Thanks for the response! We try to understand why these dependencies are shipped with the package. Generally nuget packages should have runtime dependencies and Microsoft.CodeAnalysis* are strictly compile dependecies. We are using a different version of Microsoft.CodeAnalysis which generates undesired conflicts. At the moment we are unable to migrate and are unable to change the package.
I disaggree. Microsoft.CodeAnalysis.VisualBasic is a compiler which can be used both at compile time and at runtime.
Sadly, both Microsoft.CodeAnalysis.VisualBasic and Microsoft.CodeAnalysis.CSharp have strict dependency on exact matching version of Microsoft.CodeAnalysis.Common. If your project has a transitive dependency on Microsoft.CodeAnalysis.Common, you have to resolve such version conflict manually. I won't remove dependency on Microsoft.CodeAnalysis.VisualBasic, because that would break ReportViewerCore for everyone not referencing Roslyn packages in their projects, and I don't know how to express nuget dependency to allow any (but matching) versions of Microsoft.CodeAnalysis.VisualBasic and Microsoft.CodeAnalysis.Common.
@lkosson Thank you for the package it is very useful for us as we move into .net core.
There are newer versions out there for the Microsoft.CodeAnalysis.VisualBasic, at least there is a 4.8.0 which is not a pre-release.
https://www.nuget.org/packages/Microsoft.CodeAnalysis.VisualBasic/4.9.0-2.final#versions-body-tab
Can you update the dependency to the latest non pre-release version?
Not sure if it will solve the specific version issue as even after upgrading to .net core 8.0 there are some unresolved conflicts arising from EF packages
Error NU1107 Version conflict detected for Microsoft.CodeAnalysis.Common. Install/reference Microsoft.CodeAnalysis.Common 4.8.0-3.final directly to project XXX.Api to resolve this issue. XXX.Api -> XXX.Framework.Reporting.Ssrs 1.1.0.4 -> ReportViewerCore.NETCore 15.1.19 -> Microsoft.CodeAnalysis.VisualBasic 4.8.0-3.final -> Microsoft.CodeAnalysis.Common (= 4.8.0-3.final) XXX.Api -> Microsoft.EntityFrameworkCore.Design 8.0.1 -> Microsoft.CodeAnalysis.CSharp.Workspaces 4.5.0 -> Microsoft.CodeAnalysis.Common (= 4.5.0). XXX.Api XXX.Api.csproj 1
See my comment from 2024-01-12 in this thread. ReportViewerCore can reference proper release of Microsoft.CodeAnalysis.VisualBasic or almost any previous version. The reason I have chosen 4.8.0-3.final is because Microsoft decided to reference the same version by default in new ASP.NET Core web app project with scaffolding.
You can manually install newer version of Microsoft.CodeAnalysis.Common in your project and ReportViewerCore should work just fine.
Hi @lkosson Thanks for this package.
I have the same issue.
Is the solution to install Microsoft.CodeAnalysis.Common manually?
Is it safe to ignore the Visual Studio warning?
See screenshots:
Thank you
Either:
- install
Microsoft.CodeAnalysis.Commonmanually and accept the warning - downgrade
Microsoft.VisualStudio.Web.CodeGeneration.Designto version 8.0.0 - or remove it altogether
Hi @lkosson
It looks like I don't have Microsoft.VisualStudio.Web.CodeGeneration.Design installed.
It's a dot-net 8 Blazor Web App.
Thank you
Then perhaps some other of your packages has different version of Microsoft.CodeAnalysis.Common as a dependency. Also see #56