Nuget trouble

nuget logoKeeping the versions of packages in sync was difficult today.
My MVC website must load and display a controller / view from another project. The assembly is in the bin folder and the objects are loaded using Structuremap. When running the website the debugger stopped with this error:

Could not load file or assembly ‘WebGrease, Version=,
Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its
dependencies. The located assembly’s manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040)

Seems to be a version difference between my MVC website and the loaded project. Visual Studio did supply me with a warning and a solution:

Found conflicts between different versions of the same dependent
assembly. In Visual Studio, double-click this warning (or select
it and press Enter) to fix the conflicts; otherwise, add the
following binding redirects to the “runtime” node in the
application configuration file:

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <assemblyIdentity name="WebGrease" culture="neutral" 
publicKeyToken="31bf3856ad364e35" />
  <bindingRedirect oldVersion="" 
newVersion="" />

But I don’t want to specify what version to use in my configuration.
The solution was to uninstall and (re)install a package

uninstall-package Microsoft.AspNet.Web.Optimization
install-package Microsoft.AspNet.Web.Optimization

Now both projects use the 1.5.2 version of the WebGrease package. Only needed to figure out what package to re-install.

About erictummers

Working in a DevOps team is the best thing that happened to me. I like challenges and sharing the solutions with others. On my blog I’ll mostly post about my work, but expect an occasional home project, productivity tip and tooling review.
This entry was posted in Development and tagged , , , . Bookmark the permalink.

1 Response to Nuget trouble

  1. Pingback: Nuget trouble (again) | .NET Development by Eric

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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