Visual Studio project fails with a linker error

Jan's Avatar

Jan

21 May, 2019 12:31 PM

Hi,
I have a Visual Studio 2017 solution but the build fails with a linker error

Project "C:\projects\xplaneconnect\xpcPlugin\xpcPlugin\xpcPlugin.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
  Building solution configuration "Release|x64".
Project "C:\projects\xplaneconnect\xpcPlugin\xpcPlugin\xpcPlugin.sln" (1) is building "C:\projects\xplaneconnect\xpcPlugin\xpcPlugin\xpcPlugin.vcxproj" (2) on node 1 (default targets).
PrepareForBuild:
  Creating directory "x64\Release\".
  Creating directory "x64\Release\xpcPlugin.tlog\".
InitializeBuildStatus:
  Creating "x64\Release\xpcPlugin.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:


...

"C:\projects\xplaneconnect\xpcPlugin\xpcPlugin\xpcPlugin.sln" (default target) (1) ->
"C:\projects\xplaneconnect\xpcPlugin\xpcPlugin\xpcPlugin.vcxproj" (default target) (2) ->
(Link target) -> 
  LINK : fatal error LNK1104: cannot open file 'libcpmt.lib' [C:\projects\xplaneconnect\xpcPlugin\xpcPlugin\xpcPlugin.vcxproj]
    50 Warning(s)
    1 Error(s)
Time Elapsed 00:00:13.79

The entire log can be accessed in this build
https://ci.appveyor.com/project/JanC/xplaneconnect/builds/24695311

I opened a RDP connection to that build and the project compiles fine

C:\projects\xplaneconnect\xpcPlugin>msbuild xpcPlugin/xpcPlugin.sln /p:Platform=x64 /p:Configuration=Release
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 5/21/2019 12:28:42 PM.
Project "C:\projects\xplaneconnect\xpcPlugin\xpcPlugin\xpcPlugin.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
  Building solution configuration "Release|x64".
Project "C:\projects\xplaneconnect\xpcPlugin\xpcPlugin\xpcPlugin.sln" (1) is building "C:\projects\xplaneconnect\xpcPlugin\xpcPlugin\xpcPlugin.vcxproj" (2) on node 1 (default targets)
.
InitializeBuildStatus:
  Creating "x64\Release\xpcPlugin.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
VcpkgTripletSelection:
  Using triplet "x64-windows" from "C:\Tools\vcpkg\installed\x64-windows\"
ClCompile:
  All outputs are up-to-date.
Link:
  All outputs are up-to-date.
  xpcPlugin.vcxproj -> C:\projects\xplaneconnect\xpcPlugin\xpcPlugin\..\XPlaneConnect\64\win.xpl
AppLocalFromInstalled:
  C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -noprofile -File "C:\Tools\vcpkg\scripts\buildsystems\msbuild\applocal.ps1" "C:\projects\xplaneconn
  ect\xpcPlugin\xpcPlugin\..\XPlaneConnect\64\win.xpl" "C:\Tools\vcpkg\installed\x64-windows\bin" "x64\Release\xpcPlugin.tlog\xpcPlugin.write.1u.tlog" "x64\Release\vcpkg.applocal.log"
FinalizeBuildStatus:
  Deleting file "x64\Release\xpcPlugin.tlog\unsuccessfulbuild".
  Touching "x64\Release\xpcPlugin.tlog\xpcPlugin.lastbuildstate".
Done Building Project "C:\projects\xplaneconnect\xpcPlugin\xpcPlugin\xpcPlugin.vcxproj" (default targets).

Done Building Project "C:\projects\xplaneconnect\xpcPlugin\xpcPlugin\xpcPlugin.sln" (default targets).


Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:04.69

C:\projects\xplaneconnect\xpcPlugin>

My .yml file is

branches:
  only:
  - appveyor
image: Visual Studio 2017

configuration: Release
platform:
  - x64
build:
  project: xpcPlugin/xpcPlugin/xpcPlugin.sln
  verbosity: normal

on_finish:
  - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

Any idea what the problem could be?

  1. 1 Posted by Jan on 21 May, 2019 01:37 PM

    Jan's Avatar

    I managed to reproduce it in the RDP by running

    "C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" "C:\projects\xplaneconnect\xpcPlugin\xpcPlugin\xpcPlugin.sln" /verbosity:normal
    

    When I use the MSBuild.exe from the MSBuild\14.0\ it builds fine

    "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" "C:\projects\xplaneconnect\xpcPlugin\xpcPlugin\xpcPlugin.sln" /verbosity:normal
    
  2. 2 Posted by Jan on 21 May, 2019 01:57 PM

    Jan's Avatar

    ok I found the problem.

    My MSVC .sln and .vcxproj were referencing VisualStudion 2015:

    I needed to change

    <Project DefaultTargets="Build" ToolsVersion="12.0"
    
    to
    <Project DefaultTargets="Build" ToolsVersion="14.0"
    

    and

    VisualStudioVersion = 12.0.31101.0
    

    to

    VisualStudioVersion = 15.0.28307.168
    
  3. Support Staff 3 Posted by Owen McDonnell on 21 May, 2019 03:41 PM

    Owen McDonnell's Avatar

    Thanks for sharing!

  4. Owen McDonnell closed this discussion on 21 May, 2019 03:41 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac