Visual Studio 2019中的ToolsVersion

问题描述 投票:0回答:1

我正在将多个项目从VS2010迁移到VS2019。这些项目的vcxprojs中包含工具版本4:

<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

目标VS是VS2019 v16.5.0,MSBuild版本是16.5.0.12403,所以我试图将ToolsVersion设置为16.5:

<Project DefaultTargets="Build" ToolsVersion="16.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

但是似乎MSBuild不喜欢它:

1>Building with tools version "Current".
1>Project file contains ToolsVersion="16.5". This toolset may be unknown or missing, in which case you may be able to resolve this by installing the appropriate version of MSBuild, or the build may have been forced to a particular ToolsVersion for policy reasons. Treating the project as if it had ToolsVersion="Current".

尽管构建仍然成功,但我很关心这个消息。这里有什么问题?

UPD:提供简化的项目结构示例:常用道具:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
        <ShouldUnsetParentConfigurationAndPlatform>false</ShouldUnsetParentConfigurationAndPlatform>
</PropertyGroup>
<PropertyGroup Label="Globals">
        <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
        <DotNetFrameworkVersion>v4.0</DotNetFrameworkVersion>
</PropertyGroup>
<!-- Other common variables-->
</Project>

cpp道具:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup Label="Configuration">
        <ConfigurationType>DynamicLibrary</ConfigurationType>
    </PropertyGroup>

    <PropertyGroup>
        <TargetExt>.dll</TargetExt>
    </PropertyGroup>

   <PropertyGroup Label="Configuration">
        <PlatformToolset>v142</PlatformToolset>
    </PropertyGroup>

    <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
    <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
    <Import Project="common.props" />

    <-- compiler, linker settings and so on -->
</Project>

实际项目:

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="16.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup Label="Globals">
    <ProjectName>my_name</ProjectName>
    <ProjectGuid>{my_guid}</ProjectGuid>
    <RootNamespace>my_ns</RootNamespace>
    <Keyword>my_keyword</Keyword>
  </PropertyGroup>
  <Import Project="cpp.props" />
  <-- configurations (Release, Debug, x64/Win32 and so on -->
  <-- project-specific compiler/linker settings -->
  <-- items: cpp, heanders and so on -->
  <-- references -->
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  <ImportGroup Label="ExtensionTargets">
  </ImportGroup>
</Project>
visual-studio-2010 msbuild visual-studio-2019
1个回答
0
投票

项目文件包含ToolsVersion =“ 16.5”。该工具集可能是未知的或缺少

© www.soinside.com 2019 - 2024. All rights reserved.