Are nuget assembly redirects causing you trouble?
  • Home
  • Coding
  • Are nuget assembly redirects causing you trouble?
Coding

Are nuget assembly redirects causing you trouble?

For the past few weeks, I have been refactoring some of my code and breaking it down into nuget packages. If you’ve worked with nuget packages before, you’d know that sometimes Visual Studio can be quite stubborn and will not update the assembly redirects. This can result in errors like:

I’ll be honest, this can be pretty annoying and I have been annoyed a few times in these past weeks. Therefore, to save you all the trouble, here are a few things that you can do to quickly fix your assembly redirects.

Solution #1: Re-adding assembly redirects

  1. First of all, open your App.config file.
  2. Than, find the “” section and completly remove it.
  3. Next, open the Package Manager Console.
  4. In case your solution has multiple projects, in the Default Project dropdown, select the appropriate project.
    Are nuget assembly redirects causing you trouble?
  5. Lastly, type into the console:

You should see Visual Studio trying to re-add your redirects. Once done, simply rebuild and start your project. Hopefully this should fix your problem, otherwise keep reading because I have another solution as well.

Solution #2 Reinstalling packages

I have had a time or two when simply re-adding assembly redirects for a reason or another resulted in an infinite loop. Visual Studio was not able to figure them out and just went on and on and on. While I still have to figure out why that was so, I found out that a quicker solution might be a simple reinstall of all your nuget packages.

For that, do the following:

  1. Open your App.config file, find and remove the “” section.
  2. Next, open the Package Manager Console.
  3. In case your solution has multiple projects, in the dropdown in top center, select the appropriate project.
  4. Lastly, type into the console:

This should kick off nuget to reinstall all your nuget packages. Once done, re-run the project and your error should be gone.

Related posts

Microservices: Exploring why we need them?

Haseeb Ahmed

Microservices: Do consistency and transactions exist?

Haseeb Ahmed

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.