【发布时间】:2013-12-03 06:52:33
【问题描述】:
在我的 C++ 项目 Test.wcxproj 中,我定义了以下配置:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
然后我有默认 C++ 属性的 problematic 导入:
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
当我的构建服务器构建我的 MSBuild 项目文件时(配置为 Release,平台为 Any CPU),我收到此错误:
error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
我的MSBuild 项目文件的相关部分如下所示:
<ItemGroup>
<ProjectFiles Include="$(MSBuildProjectDirectory)\**\*.csproj" />
<ProjectFiles Include="$(MSBuildProjectDirectory)\**\*.vcxproj" />
</ItemGroup>
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>x64</Platform>
<OutputFolder>$(MSBuildProjectDirectory)\BuildOutput\$(Configuration)</OutputFolder>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)</SolutionDir>
</PropertyGroup>
...
<Target Name="Compile">
<MSBuild Projects="@(ProjectFiles)" Targets="Build" Properties="Configuration=$(Configuration);Platform=$(Platform);OutputPath=$(OutputFolder)\$(MSBuildProjectName);SolutionDir=$(SolutionDir)\" />
</Target>
问题
在我的MSBuild 项目文件中,我使用的是ToolsVersion="12.0"。确实安装了Visual Studio 2013,所以我不明白为什么它选择使用v4.0\v110。我的项目配置是否因某种原因被MSBuild 跳过?我想我可以使用/p 开关以某种方式覆盖此文件夹,但我希望我的.proj 文件是独立的。
【问题讨论】:
-
能否请您提供该项目的PlatformToolset属性?看起来您在未安装 vc2012 的构建机器上构建 vc2012 项目,或者您从命令行显式传递 PlatformToolset 属性。 v110 是 vc2012 平台工具集。 v120 是 vc2013 默认平台工具集。
-
我们使用VS2013升级了一个vc2010项目。现在它在项目文件中到处都是“v120”。我们没有从命令行指定 PlatformToolset。我开始怀疑构建机器还剩下一些 VC11 beta 片段。
-
嘿,我也有同样的问题。曾经解决过吗? :)
标签: tfs msbuild visual-studio-2013