0

I am working on some background processes for a MVC4 WebApplication. I've made a separate application, independent of the Web Role to do so. I added the System.Web.Mvc reference into a Class Library so I could work with SelectListItem's and other Mvc related items on the service level (which the workers will use).

However I keep getting this error anytime the application executes:

"System.IO.FileNotFoundException: Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File name: 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'"

The odd part is, if I debug it has no issue what so ever! I've searched some and tried setting the CopyLocal and SpecificVersionNum to True. But that didn't work.

Now in the Web Roles web.config I use this assembly binding:

<dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
  </dependentAssembly>

To ensure I avoid errors like this. Do I have do something similar for the Class Library? If so how? Last I checked putting configs on class libraries was a HUGE no no.

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
mBrice1024
  • 790
  • 5
  • 25

0 Answers0