Visual Studio 2010 Beta 2 中的目标 .NET 3.5 C++/CLI

发布于 2024-08-18 18:29:21 字数 646 浏览 12 评论 0原文

有没有人成功地将 VS 2008 C++/CLI (vcproj) 项目转换为 VS 2010 项目 (vcxproj),同时保持 .NET 3.5 作为目标框架?我无法做到这一点并使项目成功构建。该项目在 VS2008 中编译为 .NET 3.5,在 VS2010 中编译为 .NET 4.0,但我无法在 2010 年以 .NET 3.5 为目标。IDE 似乎没有为其提供选项,并修改 vcxproj 文件添加

<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>

会导致编译失败并出现以下错误:

Error   1   error C1001: An internal error has occurred in the compiler.

根据 此链接,显然VS2008和2010之间使用的编译器存在一些差异,但仍然建议手动编辑项目文件作为解决方案。有人对此有任何想法吗?

Has anyone had any success converting a VS 2008 C++/CLI (vcproj) project to a VS 2010 project (vcxproj), whilst maintaining .NET 3.5 as the target framework? I haven't been able to do this and get the project to build successfully. The project compiles fine in VS2008 as .NET 3.5, and fine in VS2010 as .NET 4.0, but I am unable to target .NET 3.5 in 2010. The IDE doesn't seem to provide an option for it, and modifying the vcxproj file by adding

<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>

causes compilation to fail with the folling error:

Error   1   error C1001: An internal error has occurred in the compiler.

According to this link, there is apparently some differences in compilers used between VS2008 and 2010, but manually editing the project file was still suggested as a solution. Does anyone have any idea on this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

妳是的陽光 2024-08-25 18:29:21

当您以 .Net Framework v3.5 为目标并使用 VS2010 进行构建时,有时可能会触发链接器错误 C1001,因为 VS2010 在您编译时会自动添加对 System.Core 的引用。这不是明确的,也不会显示在您的引用中,而是在编译时完成。您可以通过在 Globals PropertyGroup 中添加此元素来告诉 VS 不要添加程序集:

<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>

When you're targeting .Net framework v3.5 and building using VS2010 you can sometimes trigger the linker error C1001 due to VS2010 automatically adding a reference to System.Core when you're compiling. This isn't explicit and will not show up in your references but rather done during compile time. You can tell VS to not add the assemblies by adding this element in your Globals PropertyGroup:

<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
溇涏 2024-08-25 18:29:21

哇,对 Brickner 的错误报告 是毁灭性的 - 不支持目标 3.5,也不会修复!

我自己对崩溃的奇怪经历是,它们是通过打开预编译头来修复的,更奇怪的是,因为 stdafx.h 是空的,所以我不知道它们在做什么。

Wow, the response to Brickner's bug report is devastating - targeting 3.5 is not supported and won't be fixed!

My own weird experiences with crashes are that they were fixed by turning on precompiled headers, even more strange because stdafx.h was empty so I don't know what they are doing.

别再吹冷风 2024-08-25 18:29:21

安装此修补程序,您的麻烦可能就会消失:http://support.microsoft.com/kb/976656

Install this hotfix and your troubles are probably gone: http://support.microsoft.com/kb/976656

溺孤伤于心 2024-08-25 18:29:21

感谢您提供有关 TargetFrameworkVersion 的提示。它对我有用,但不幸的是这对你没有帮助。

如果您有一些为其他版本的 C++ 编译器制作的旧文件(PCH 文件、目标文件),则很容易出现“内部编译器错误”。你什么时候清理过所有东西吗?
您更改了工具版本吗?

Thanks for the tip on TargetFrameworkVersion. It worked for me, but this unfortunately does not help you.

It is easy to get "internal compiler error" if you have some old files (PCH files, object files) made for another version of the C++ compiler lying around. Have you cleaned everything when
you changed tools version?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文