Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

NuGet package breaks publication to Windows Azure #49

Closed
breyed opened this Issue Feb 27, 2013 · 8 comments

Comments

Projects
None yet
3 participants

breyed commented Feb 27, 2013

Adding the postal NuGet package to a MVC 4 project causes Windows Azure to complain, "Could not load file or assembly 'System.Web.Razor''. The project stems from the NuGet package overwriting the project's reference to System.Web.Razor with an old version. See this SO Q&A for details.

Owner

andrewdavey commented Mar 3, 2013

I've just released Postal 0.8.1, which should fix this problem. It now depends on Razor v2 instead of v1.

@andrewdavey andrewdavey closed this Mar 3, 2013

I'm using version 0.8.2 and it's still breaking my deployment.

Owner

andrewdavey commented May 26, 2013

Can you provide more information please? Stack trace, version of MVC and .NET, etc

Yes, sorry, I'm using MVC 4 and .NET 4.5.

When I add the nuget package I cannot deploy to azure, it keeps cycling but I cannot seem to find the details of the error.

This is the specific error, it seems the library has a hard reference to Mvc version 3, I'm using Mvc 4.

Unable to load the role entry point due to the following exceptions:

System.IO.FileLoadException: Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0, 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)

Does it works in Mvc 4? is there a workaround?

Thanks.

Owner

andrewdavey commented May 31, 2013

I think you just need an assembly binding redirect for MVC added to web.config. Take a look at this http://www.davidyardy.com/davidyardy/blog/post/2012/12/04/Upgrading-to-MVC-4-(from-prior-versions).aspx

I already have those bindings in my web.config:

      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>

It's working now, it seems that for azure assembly bindings must be also in another config file: http://stackoverflow.com/questions/15226494/assembly-binding-redirect-not-working

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment