切换目标.NET版本,现在项目将无法构建

时间:2013-07-03 17:56:33

标签: c# .net visual-studio-2010

我正在运行VS 2010,我有一个最初设置为.NET 4.0的项目。这个版本的.NET对于这个应用程序预期运行的许多Windows平台来说太高了,所以我将它从.NET 4.0切换到.NET 2.0。现在,该项目没有建立。

起初我得到了项目资源的空引用异常。我在MSDN论坛上发现this link,证明有助于解决该问题。从本质上讲,有效的答案(在众多中)是改变所有实例:

Version=4.0.0.0

Version=2.0.0.0

...在* .resx文件中。我对项目目录中找到的所有* .resx文件执行了此操作。 Walla,在构建期间不再有null引用异常。但是,现在项目无法构建,构建窗口无法提供任何帮助来解决问题。这就是字面意思:

2>CoreCompile:
2>  C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /platform:x86 /errorreport:prompt /warn:4 /define:TRACE /reference:C:\Users\afalanga\Dev\Tools\Program\FrontEnd\Resources\WrapNativeLibrary.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Deployment.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Management.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /debug:pdbonly /filealign:512 /optimize+ /out:obj\x86\Release\FrontEnd.exe /resource:obj\x86\Release\FrontEnd.Panel.resources /resource:obj\x86\Release\FrontEnd.PrivilegesForm.resources /resource:obj\x86\Release\FrontEnd.Main.resources /resource:obj\x86\Release\FrontEnd.Properties.Resources.resources /resource:obj\x86\Release\FrontEnd.SoftwareLicense.resources /resource:Resources\WrapNativeLibrary.dll,WindowsUpdateTool.Resources.WrapNativeLibrary.dll /resource:Resources\INativeLibrary.dll,FrontEnd.Resources.INativeLibrary.dll /target:exe /win32icon:Resources\FrontEnd.ico /win32manifest:Resources\app.manifest Environment.cs Check.cs Exceptions.cs Updater.cs LibAccess.cs PrivilegesForm.cs Form1.Designer.cs OSInfo.cs Constants.cs PersonalizationManager.cs Silent.cs drivePanel.cs drivePanel.Designer.cs Main.cs Main.Designer.cs Program.cs Properties\AssemblyInfo.cs SoftwareLicense.cs SoftwareLicense.designer.cs VerticalProgressBar.cs Properties\Resources.Designer.cs Properties\Settings.Designer.cs
2>
2>Build FAILED.

是否因为引用的C#编译器是4.0版本?在这一点上,我完全不知道要检查什么。我正在考虑从TFS对这个代码进行新的检查,然后在那里尝试,但还没有走过那条路。我很欣赏任何见解,因为我从项目属性中可以看到的一切都说它应该针对.NET 2.0并且“应该”构建。

谢谢, 安迪

1 个答案:

答案 0 :(得分:2)

当您降级构建目标时,最好先从新项目开始,更改构建目标,然后将代码导入其中。这样,所有核心依赖项都可以正确启动,您只需要担心代码能够正常工作。