我有一個webproject我試圖主機,但在服務器嘗試編譯它,我得到以下錯誤:無法加載文件或程序集Microsoft.CodeAnalysis
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=1.1.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) ---> System.IO.FileLoadException: Could not load file or assembly 'Microsoft.CodeAnalysis, 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)
--- End of inner exception stack trace --- at Microsoft.CodeAnalysis.CSharp.CommandLine.Program.Main(String[] args)
所以服務器有一個較舊的CodeAnalysis版本比我的項目。所以讓我們嘗試綁定重定向!
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.9.9.9" newVersion="1.0.0.0" />
</dependentAssembly>
不幸的是,我仍然得到相同的錯誤。我究竟做錯了什麼?
與解決類似的問題,可以在這裏找到:https://stackoverflow.com/questions/40235284/asp-net-mvc- razor-view-cs1525-invalid-expression-term – Matt