为什么AppVeyor对VS2015图像使用VS2010工具? [英] Why does AppVeyor use VS2010 tools for VS2015 image?
问题描述
我们是C ++库.我们正在努力使用AppVeyor和Visual Studio构建具有x64构建的图像. Visual Studio为Win32构建映像会遇到相同的问题,但是由于某些[未知]原因,它们已成功完成.
We are a C++ library. We are struggling with AppVeyor and Visual Studio build images with x64 builds. Visual Studio build images for Win32 suffer the same problem, but for some [unknown] reason, they complete successfully.
我们正在尝试使用Visual Studio 2015构建映像(以及其他):
We are attempting to use the Visual Studio 2015 build image (among others):
当我们检查命令行时,似乎我们正在使用Visual Studio 2010编译器( Visual Studio 10.0是VS2010 ):
When we inspect the command line, it appears we are using the Visual Studio 2010 compiler (Visual Studio 10.0 is VS2010):
我们的AppVeyor配置文件位于 Noloader GitHub | .appveyor.yml .也显示在下面.
Our AppVeyor configuration file is located at Noloader GitHub | .appveyor.yml. It is also shown below.
一切都是通过.appveyor.yml
.没有任何会影响事物的隐藏设置(或者我们不相信).我们需要.appveyor.yml
中的所有内容,以便人们可以对其进行克隆,并且一切对他们都有效".
Everything is driven through .appveyor.yml
. There are no hidden settings that are affecting things (or we don't believe so). We want everything in .appveyor.yml
so people can clone it and things "just work" for them.
项目文件位于GitHub上的 cryptest.vcxproj
和 cryptlib.vcxproj
. * .vcxproj文件使用硬编码的$(DefaultPlatformToolset)
作为@stinj建议的. ( EDIT :DefaultPlatformToolset
-不再.我们已完全删除了DefaultPlatformToolset
和PlatformToolset
).
The project files are located in GitHub at cryptest.vcxproj
and cryptlib.vcxproj
. The *.vcxproj files use a hard-coded $(DefaultPlatformToolset)
as suggested by @stinj. (EDIT: DefaultPlatformToolset
- not anymore. We completely removed DefaultPlatformToolset
and PlatformToolset
).
项目的构建结果位于 Noloader AppVeyor | cryptopp .屏幕截图的来源.
The build results for the project are located at Noloader AppVeyor | cryptopp. Its the source of the screen captures.
为什么使用了错误的构建工具,我们该如何解决?
Why are the wrong build tools being used, and how do we fix it?
当我避免使用$(DefaultPlatformToolset)
并将平台工具集的值硬编码时,会导致另一个错误.例如,以下是Visual Studio 2015构建图像.当工具集版本设置为v140
(即VS2015版本值)时,它就会死掉.真是令人困惑.
When I avoid $(DefaultPlatformToolset)
and hard code the the value of the platform toolset, it causes yet another error. For example, below is for the Visual Studio 2015 build image. It dies when the toolset version is set to v140
, which is the VS2015 version value. It is befuddling.
( ="提交ac513c06f8c8 最终被恢复,因为它使事情变得比以前更糟了).
(Commit ac513c06f8c8 was eventually reverted because it broke things worse than before).
当我们完全删除VCXPROJ文件中的所有PlatformToolset
和DefaultPlatformToolset
迹线时,将导致相同的错误.下面是Visual Studio 2017构建映像.
When we completely remove all traces of PlatformToolset
and DefaultPlatformToolset
in our VCXPROJ files, it results in the same error. Below is from a Visual Studio 2017 build image.
version: 1.0.{build}
clone_depth: 3
configuration:
- Debug
- Release
platform:
- Win32
- x64
image:
- Visual Studio 2017
- Visual Studio 2015
- Visual Studio 2013
build: off
test_script:
- cmd: >-
msbuild /t:Build /p:platform=%platform%;configuration=%configuration% cryptlib.vcxproj
msbuild /t:Build /p:platform=%platform%;configuration=%configuration% cryptest.vcxproj
msbuild /t:CopyCryptestToRoot cryptest.vcxproj
cryptest.exe v
cryptest.exe tv all
matrix:
exclude:
# - platform: x64
# configuration: Debug
# - platform: x64
# configuration: Release
- image: Visual Studio 2010
- image: Visual Studio 2017
notifications:
- provider: Email
to:
- cryptopp-build@googlegroups.com
on_build_success: true
on_build_failure: true
推荐答案
这是我的工作方式:
-
在两个
.vcxproj
文件中分别设置ToolsVersion="$(ToolsVersion)"
和<PlatformToolset>$(TOOLSET)</PlatformToolset>
添加值为v140
的环境变量TOOLSET
和值为14.0
Add Environment variables TOOLSET
with value v140
and ToolsVersion
with value 14.0
要使用不同的变量来实现所需的所有组合,可以使用构建矩阵并避免与从矩阵中排除配置.
To achieve all combinations you need with different variables you can use build matrix and avoid combinations you do not need with exclude configuration from the matrix.
更新:矩阵样本
image:
- Visual Studio 2015
- Visual Studio 2013
platform:
- x64
- x86
environment:
matrix:
- TOOLSET: v140
ToolsVersion: 14.0
- TOOLSET: v100
ToolsVersion: 4.0
matrix:
exclude:
- image: Visual Studio 2015
TOOLSET: v100
ToolsVersion: 4.0
- image: Visual Studio 2013
TOOLSET: v140
ToolsVersion: 14.0
这篇关于为什么AppVeyor对VS2015图像使用VS2010工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!