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=1.5.1.25624,
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">
 <dependentAssembly>
  <assemblyIdentity name="WebGrease" culture="neutral" 
publicKeyToken="31bf3856ad364e35" />
  <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" 
newVersion="1.5.2.14234" />
 </dependentAssembly>
</assemblyBinding>

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

My work as a recruited developer changes almost every month. 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.

One 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:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s