VS: cmake 3.9.0 randomly errors out on Appveyor build machine with MSBuild.exe failure
Recently we have switched to cmake 3.9.0 and found random failures related to MSBuild.
Command line sample: cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_BUILD_TYPE=Release
CMake output:
CMake Error at CMakeLists.txt:19 (project):
Failed to run MSBuild command:
C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe
to get the value of VCTargetsPath:
Microsoft (R) Build Engine version 14.0.25420.1
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 7/29/2017 12:38:16 AM.
The target "_ConvertPdbFiles" listed in a BeforeTargets attribute at "C:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets (45,37)" does not exist in the project, and will be ignored.
The target "_CollectPdbFiles" listed in an AfterTargets attribute at "C:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets (45,70)" does not exist in the project, and will be ignored.
The target "_CollectMdbFiles" listed in a BeforeTargets attribute at "C:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets (52,38)" does not exist in the project, and will be ignored.
The target "_CopyMdbFiles" listed in an AfterTargets attribute at "C:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets (52,71)" does not exist in the project, and will be ignored.
Project "C:\projects\arrow\cpp\build\CMakeFiles\3.9.0\VCTargetsPath.vcxproj" on node 1 (default targets).
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(349,5): error MSB8013: This project doesn't contain the Configuration and Platform combination of Release|x64. [C:\projects\arrow\cpp\build\CMakeFiles\3.9.0\VCTargetsPath.vcxproj]
Done Building Project "C:\projects\arrow\cpp\build\CMakeFiles\3.9.0\VCTargetsPath.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\projects\arrow\cpp\build\CMakeFiles\3.9.0\VCTargetsPath.vcxproj" (default target) (1) ->
(PrepareForBuild target) ->
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(349,5): error MSB8013: This project doesn't contain the Configuration and Platform combination of Release|x64. [C:\projects\arrow\cpp\build\CMakeFiles\3.9.0\VCTargetsPath.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:01.97
Exit code: 1
We have noticed that 3.9.0 version of cmake generates folder "3.9.0" and puts VCTargetsPath.vcxproj file into it.
Content of the VCTargetsPath.vcxproj
on failure is following:
<?xml version="1.0" encoding="UTF-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{F3FC6D86-508D-3FB1-96D2-995F08B142EC}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<Platform>x64</Platform>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
<PropertyGroup Label="Configuration">
<ConfigurationType>Utility</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
<ItemDefinitionGroup>
<PostBuildEvent>
<Command>echo VCTargetsPath=$(VCTargetsPath)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
</Project>
Full content of CMake build directory during the failure is attached as zip archive.
Link to AppVeyor job with failure: https://ci.appveyor.com/project/ApacheSoftwareFoundation/arrow/build/1.0.2593/job/q484cyl1one8gn2l