5

I'm trying to deploy my site to my hosting provider and keep receiving the following error:

Could not load file or assembly 'System.Web.Razor' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

[FileLoadException: Could not load file or assembly 'System.Web.Razor' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]

[FileLoadException: Could not load file or assembly 'System.Web.Razor, Version=2.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)]

...

[ConfigurationErrorsException: Could not load file or assembly 'System.Web.Razor, Version=2.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)]

...

[HttpException (0x80004005): Could not load file or assembly 'System.Web.Razor, Version=2.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)]

...

The site is built using ASP.NET 4 and MVC 4. Everything works fine on my development machine running Windows 8. I've copied the System.Web.Razor.dll to the bin folder on the server which doesn't make any difference, though this appears to be the v1.0 versioned assembly (~260k).

I've looked in

C:\Windows\Assembly
and don't see anything in there specifically for System.Web.Razor. However, I do have the following two files:

  • C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Web.Razor\04eb82505c0086e8eb097d1408183aa0\System.Web.Razor.ni.dll (776k, file version: 1.0.20105.407)

  • C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Web.Razor\ab032b45c588b488ebca535054d827bc\System.Web.Razor.ni.dll (1823k, file version: 2.0.20715.0)

However, even copying the v2 assembly from here didn't work, though I don't think this is right file anyway as the v1 assembly file sizes don't match up either.

Any ideas on what is going on here?

I'm guessing that my hosting provider doesn't have something installed (as they keep telling me to put everything in the bin folder), but I'm curious as to why I can't find this System.Web.Razor v2 DLL anywhere.

To debug, I also uploaded the empty website with the basic template which worked fine. Interestingly, when I added the reference to Postal and deployed again, I got the error - but even when I reverted the files back, the error persisted! Why would this happen?

Any help would be appreciated. Starting to feel a little out of ideas.

Edit 1

Created a new empty project, added Razor 2 from nuget, Set System.Web.Razor.dll to copy local (2.0.20715.0, 260k), published, grabbed the file and uploaded it, and still get the same error? It seems like this DLL just won't be picked up.

Edit 2

Eventually I gave up trying to use the hosting provider in question. They didn't have ASP.NET MVC 4 installed on the server, which I think was ultimately the problem. Tried a different host which does have this installed and everything works fine.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.