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've also experienced a similar issue using a Web Deployment Project to pre-compile an ASP.NET Web Site Project in VS2010 (.NET 4.0).
Everything worked fine until I installed VS2012 (which installs .NET 4.5 - I presume that is related) which started giving me:
System.BadImageFormatException: Bad binary signature. (Exception from HRESULT: 0x80131192)After some debugging and isolated test cases I tracked the issue down to a lambda being passed between the .NET 4.0 web site and another .NET 3.5 project.
The method defined in the 3.5 project had a signature like this:
which was being used in the 4.0 website in a property getter resulting in the error when merged via aspnet_merge:
In my test case I recreated
ExecuteAsEnumerableas an different named extension method inside the 4.0 web site, pre-compiled, and it worked. After checking the "Target .NET Framework" of the project and realising it was 3.5 (I hadn't realised before), I switched everything to 4.0, and everything worked again.Something obviously changed in the .NET 4.5 update (which was an in place upgrade over 4.0). In my case I could recompile the project in question - I'm not sure everyone would have that luxury (is that the right word?).
Hope that helps.