Skip to content

ToolsVersion should be ignored by MSBuild task #4319

Open
@jeffkl

Description

MSBuild ignores ToolsVersion in most places but the MSBuild task is still trying to honor it

Steps to reproduce

If you specify an invalid ToolsVersion to an MSBuild task invocation, the build will fail:

Project file

<Project>
  <ItemGroup>
    <MyProjects Include="$(MSBuildProjectFullPath)"
                ToolsVersion="BadToolsVersion" />
  </ItemGroup>

  <Target Name="Build">
    <MSBuild Projects="@(MyProjects)" />
  </Target>
</Project>

Command line

msbuild /bl

Expected behavior

ToolsVersion to not be respected and ignored like ToolsVersion is ignored everywhere else.

Actual behavior

Build error:

error MSB4132: The tools version "BadToolsVersion" is unrecognized. Available tools versions are "Current", "2.0", "3.5", "4.0".

Environment data

msbuild /version output:

Microsoft (R) Build Engine version 16.1.59-preview+gd8f1537cf1 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

16.1.59.61912

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions