2012-04-24 65 views
6

我必須將C++項目的目標框架從4.0更改爲3.5。我發現這個問題/回答如何做到這一點有所幫助:Change C++/CLI project to another framework than 4.0 with vs2010
我碰到以下問題,但:我得到警告:將C++項目從4.0轉換爲3.5框架

warning MSB3258: The primary reference "path\file.dll" could not be resolved because it has an indirect dependency on the .NET Framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which has a higher version "4.0.0.0" than the version "2.0.0.0" in the current target framework 

與同爲System, Version=4.0.0.0Microsoft.VisualC, Version=10.0.0.0System.Configuration, Version=4.0.0.0System.Xml, Version=4.0.0.0System.Security, Version=4.0.0.0 ,和System.Data.SqlXml, Version=4.0.0.0。這會導致依賴於無法找到的file.dll的所有項目出現錯誤。
我不知道如何解決這個問題。我也安裝了Visual Studio 2008 - 儘管它似乎並不在意,並且使用Platform Toolset v90甚至可以使C++項目無法構建。請幫忙 !

+0

您是否安裝了3.5框架? http://www.microsoft.com/download/en/details.aspx?id=21 – 2012-04-24 21:41:08

+0

是的,並且所有的網絡應用程序我都能正常工作,除了那些依賴於我試圖修復的應用程序 – Thalia 2012-04-24 21:50:18

回答

9

Visual C++編譯器版本16.00(隨Visual Studio 2010提供)無法定位除4.0以外的任何框架版本。要使用3.5版本,您必須使用舊版(Visual Studio 2008)版本的C++編譯器,並且您將無法使用新的C++語言功能(例如初步的C++ 11支持)。

通過選擇平臺工具鏈v90,您可以繼續使用Visual Studio 2010 IDE。

+0

我一直在試圖解決包含在.rc文件中的下列項目,該文件顯然不包含在VS2008 Express中:#include「afxres.h」。我發現它可以替換爲windows.h,但我不確定它能正常工作。在VS2010中,它能夠找到afxres.h文件。 – Thalia 2012-04-24 23:39:03