I'm experiencing the same issue reported here: "Bad binary signature" in ASP.NET MVC application
The ASP.Net MVC site works fine on the local machine, but when deployed using a combination of aspnet_compiler, aspnet_merge, and msdeploy, loading any page will fail with the following error:
System.BadImageFormatException Bad binary signature. (Exception from HRESULT: 0x80131192)
The accepted solution in the linked question suggests that the issue is caused by using the wrong version of aspnet_merge, and I have verified that removing the aspnet_merge step from the deployment solves the issue.
My problem is that using the correct aspnet_merge version doesn't appear to resolve the issue.
The web application is targeting .Net 4.0 64-bit. The aspnet_merge path used is: "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\aspnet_merge.exe"
[EDIT]
Local dev is:
- VS2010 SP1
- Cassini
- x64
- VS11 Beta and .Net 4.5 are installed
Build paths are:
- C:\Windows\Microsoft.NET\Framework\v4.0.30319\
- C:\Program Files (x86)\IIS\Microsoft Web Deploy V2\
I encountered this exception as well. It wasn't a aspnet_merge version issue either, nor an issue with the target framework as far as I can tell. It is however on a older project recently updated to MVC 5.
I had this code in the Razor view:
It uses Linq and
DistinctBy
for the MoreLinq library. As this shouldn't be in a View anyway, I moved it to the controller and the exception vanished.