我有一個ASP.NET 3.5解決方案,最近升級到.NET 4.0上運行。儘管如此,解決方案中的大多數項目似乎仍然是以.NET 3.5 Framework爲目標的。無法加載文件或程序集'System.Core,版本= 3.5.0.0'
這就是說,我現在無法調試任何這些項目。我得到以下錯誤:
Parser Error Message: Could not load file or assembly 'System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
=== Pre-bind state information === LOG: User = myusername LOG: DisplayName = System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 (Fully-specified) LOG: Appbase = file:///C:/Projects/myprojectpath/ LOG: Initial PrivatePath = C:\Projects\myprojectpath\bin Calling assembly : (Unknown). === LOG: This bind starts in default load context. LOG: Using application configuration file: C:\Projects\myprojectpath\web.config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config. LOG: Post-policy reference: System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 LOG: The same bind was seen before, and was failed with hr = 0x80070002.
我手動編輯我的項目文件中,描述here,並添加以下行:
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
但它確實沒有好。有人可以解釋爲什麼我得到這個錯誤信息以及如何解決它?謝謝!
當您更改目標框架.NET 4從項目屬性在VS. – 2012-07-30 19:44:22
我想它應該會自動更新引用改變目標框架爲4.0,但它沒有幫助 – 2012-07-30 20:04:31
這可能是由於手動編輯,通常你需要單獨更改每個項目的目標框架,我可以建議你創建一個.net4項目相同的類型,並嘗試比較.csproj文件來源以找出差異。 – 2012-07-30 20:50:34