I have a Visual Studio solution with an asp.net web application project and a class library project alongside it.
The applications runs fine when I debug it in Visual Studio, however when I deploy it using WebDeploy, I get the following exception when loading the page:
System.IO.FileLoadException:
Could not load file or assembly 'Microsoft.CodeAnalysis.CSharp, Version=1.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)
This also happens when deploying to a Folder.
My web project references Microsoft.CodeAnalysis.CSharp version 3.0.0, installed via Nuget and I can see it in the packages folder. Web.config contains this:
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
Super confused- I don't see any 1.0.0.0 references anywhere and I don't know how I'm supposed to resolve this. I even tried manually installing version 1.0.0.0 of Microsoft.CodeAnalysis.CSharp alongside the current version and nothing changes.
EDIT:
Okay so this appears to be resolved by turning the "Precompile during publish" option off when deploying. Hesitant to answer my own post with this because I suspect this is not a real solution.