l33*_*33t 8 msbuild tfs visual-studio-2013
在我的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>
Run Code Online (Sandbox Code Playgroud)
然后我有问题导入默认的C++属性:
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
Run Code Online (Sandbox Code Playgroud)
当我的构建服务器构建我的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.
Run Code Online (Sandbox Code Playgroud)
我的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>
Run Code Online (Sandbox Code Playgroud)
在我的MSBuild
项目文件中,我正在使用ToolsVersion="12.0"
.Visual Studio 2013
确实安装了,所以我不明白它为什么选择使用v4.0\v110
.我的项目配置是否因为某些原因而跳过了MSBuild
?我想我可以使用/p
开关以某种方式覆盖此文件夹,但我希望我的.proj
文件是自包含的.
尝试设置环境变量
VisualStudioVersion=12.0
Run Code Online (Sandbox Code Playgroud)
或者将它作为属性显式传递给命令行上的msbuild
msbuild.exe <project or solution to build> /p:VisualStudioVersion=12.0
Run Code Online (Sandbox Code Playgroud)
我认为这是因为微软试图保持与旧版Visual Studio的兼容性.
请参阅Visual Studio项目兼容性和VisualStudioVersion
就我而言,我的构建定义被配置为构建我的.sln
文件而不是我的.proj
文件。我记得配置它来构建 MSBuild 项目,但不知何故它似乎已经恢复到解决方案。
无论如何,我找到了解决该问题的两个方法:
.proj
文件(其中工具版本确实设置为12.0
)。 归档时间: |
|
查看次数: |
28221 次 |
最近记录: |