我的老师被学校推荐使用 Visual Studio 2010,因为他们不想费心安装任何新东西。我一直在使用 Visual Studio 2015,并且非常喜欢它。但是,当她尝试运行任何代码时,会产生一堆错误。我尝试了通过编辑解决方案文件使 2013⁄2012 项目与 2010 兼容的解决方案,但它仍然会产生错误。有解决办法吗?
这是我尝试在 Visual Studio 2010 中运行源文件时的控制台输出:
1>------ Build started: Project: typingSalon, Configuration: Debug Win32 ------
1>Build started 4/8/2015 8:19:30 AM.
1>Project file contains ToolsVersion="14.0". This toolset is unknown or missing. You may be able to resolve this by installing the appropriate .NET Framework for this toolset. Treating the project as if it had ToolsVersion="4.0".
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Cpp.Win32.Targets(518,5): error MSB8008: Specified platform toolset (v140) is not installed or invalid. Please make sure that a supported PlatformToolset value is selected.
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.05
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
原文由 Griffin Melson 发布,翻译遵循 CC BY-SA 4.0 许可协议
问题是项目文件引用了
v140
C++ 工具集,这基本上意味着 _使用 Visual Studio 2015 中的 C++ 编译器_。未安装此编译器,这会导致您的错误消息。在我看来,有两种方法可以让你克服你的情况:
在您的计算机上安装 Visual Studio 2010。然后,从 2015 年开始,在项目设置中选择 2010 平台工具集。您的项目将始终使用 2010 进行编译,但您的优势是不会意外使用 2010 没有的 C++ 功能。
不要在您的计算机上安装 Visual Studio 2010,而是使用第二台计算机(仅安装 2010)创建第二个构建配置,其中平台工具集设置为 Visual Studio 2010 (v100)。根据您使用的 Visual Studio 使用适当的配置。
这两种解决方案基本上意味着您不使用 Visual Studio 2015 相对于 Visual Studio 2010 改进的 C++ 功能,这有点遗憾。