Visual Studio: Found conflicts between different versions of assembly

When trying to install NuGet packages in Visual Studio that are not directly from Microsoft, you sometimes get the following error message. The package in question cannot be installed due to this conflict.

Found conflicts between different versions of “assembly” that could not be resolved. There was a conflict between “assembly, Version=X.0.0.0, […] and ” assembly, Version=Y.0.0.0,

The detailed error message looks something like the following, which at first makes you feel overwhelmed:

Found conflicts between different versions of “Microsoft.Extensions.DependencyInjection.Abstractions” that could not be resolved.There was a conflict between “Microsoft.Extensions.DependencyInjection.Abstractions, Version=, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL” and “Microsoft.Extensions.DependencyInjection.Abstractions, Version=, Culture=neutral, PublicKeyToken=adb9793829ddae60”.    “Microsoft.Extensions.DependencyInjection.Abstractions, Version=, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL” was chosen because it was primary and “Microsoft.Extensions.DependencyInjection.Abstractions, Version=, Culture=neutral, PublicKeyToken=adb9793829ddae60” was not.    References which depend on “Microsoft.Extensions.DependencyInjection.Abstractions, Version=, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL” [].        Unresolved primary reference with an item include of “Microsoft.Extensions.DependencyInjection.Abstractions, Version=, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL”.    References which depend on “Microsoft.Extensions.DependencyInjection.Abstractions, Version=, Culture=neutral, PublicKeyToken=adb9793829ddae60” [].

In this case there are dependencies to another package, which is installed in a higher, more current version, which are not yet supported by the package to be installed.

In this case, the best way to uninstall the package in question is to use the Nuget Package Manager, which can be accessed by right-clicking on the project and then selecting “Manage NuGet Packages…”. Or you can go via the “Tools” menu ➤ “Nuget Package Manager” ➤ “Manage NuGet Packages for Solution”. New dependencies may appear in the process. It may not be possible to uninstall it because other packages are dependent on this package. So you have to uninstall these packages first.

Now there are two possibilities: Either you install the uninstalled packages individually in the desired version or you install the actual packages and hope that the dependent packages are installed in the correct version. The latter option is of course the faster and easier one.

Visual Studio: Found conflicts between different versions of packages
Reinstall component via NuGet Package Manager

One can only hope that the described procedure leads to success. Sometimes a simple reinstall via the Package Manager Console helps. And in complex projects, scenarios are also conceivable in which different versions of the assemblies must be managed, because different third-party packages have the same dependencies, but the dependencies to different versions exist. Cheers to that. Luck to the one who does this full-time and/or can take the necessary time for it. The actual programming suddenly becomes a minor matter.

Leave a Reply

Your email address will not be published. Required fields are marked *