I have a VS 2005 web site that I publish using \"Publish Web Site\", and I clear all the three checkboxes. I also have a deployment project that picks up the published files
I have been struggling to fix this issue for past few days. At least in my case, the error message was completely misleading and had nothing to do with precompiled website. There are many articles or posts out there that give many different answers which only add to confusion. I personally believe this error is caused mainly due to missing references or incorrect versioning. In order to fix the issue as fast as possible you have to rule this out, or otherwise fix the missing/wrong reference.
To do so you need to use a tool named "Assembly Binding Log Viewer". This tool will tell you which references are missing or have wrong versions. If there is a missing/mismatched reference then go ahead and fix it; otherwise you need to do the other magic tricks like checking for App Pool being 32-bit or permissions.
Steps:
At your server create the following folders
C:\fuslog C:\fuslog\logs
Copy Assembly Binding Log Viewer to your server at C:\fuslog:
You can find the program at a location like this
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\fuslogvw.exe
You might need to look at "Program Files" instead of "Program Files (x86)" or look into different vesions instead of "v7.0A"
Execute fuslogvw.exe at server
Click on "Setting..."
Ensure "Log bind failures to disk" is checked
Check the Enable custom log path and enter the following in the box: C:\fuslog\logs
Click on OK
Recycle/reset your app pool to enforce a fresh binding
Click on Refresh. Now you can see the failed binding in here
The better way to find the exact binding is to go to c:\fuslog\logs\Default. In here you can find the exact binding failures. Some are irrelevant and you need to find the critical one by trial and error. Mine was the following failure:
System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35
I fixed the issue by adding the following entry at my web sites web.config:
<configuration>
...
<runtime>
...
<!-- Added this entry to fix the issue -->
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.0" />
</dependentAssembly>
...
</runtime>
...
</configuration>
I hope this helps others to quickly fix the issue.
I had the same problem when I started using VWD Express 2012 (after I was using Express 2010, which used to work okay) Went to my hosting control panels and changed ASP.NET version from 2.0-Classic to 4.0 Classic as shown. Problem gone.
For me, I had a script that deletes the production folder and then copies up the new files.
The script failed to delete the production folder properly leaving that the old and new files were mixed in together causing the error.
I manually deleted the entire folder and redeployed successfully...then updated the script.
Start by checking available disc space. I got this error when we ran out of space on the hard drive hosting IIS.
In my case of an error for an asp.net mvc razor view (.cshtml), /bin folder contained two .compiled files for the same view. One of them was old and needed to be deleted.
I also had a second view in the controller views subfolder which also needed to be deleted.
The reason for a problem is that I moved a view from controller views subfolder into the Shared folder, however my deployment process (Visual Studio Publish) did not delete the obsolete view and view.compiled files from the server. You can instruct Visual Studio to always clean up the destination folder, but this would make the deployment process slower.
If you get this error when running an MSBuild script, chances are that your project is a 2.0 or 3.5 project and MSBuild is using the 4.0 compiler. Try adding:
TargetFrameworkMoniker="3.5"
to your AspNetCompiler directives.