INVALID静态方法调用语法[MSBUILD] :: ISTARGETFRAMEWORKCOMPATIPAL-如何解决

问题描述 投票:0回答:1
在更新Microsoft.extensions.configuration.binder到版本9.0之后,我们看到了一个构建错误:

Task : MSBuild Description : Build with MSBuild Version : 1.179.0 Author : Microsoft Corporation ... ##[error]C:\WINDOWS\ServiceProfiles\NetworkService\.nuget\packages\microsoft.extensions.configuration.binder\9.0.1\buildTransitive\netstandard2.0\Microsoft.Extensions.Configuration.Binder.targets(20,17): Error MSB4186: Invalid static method invocation syntax: "[MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netcoreapp2.0')". Method '[MSBuild]::IsTargetFrameworkCompatible' not found. Static method invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(`a`, `b`)). Check that all parameters are defined, are of the correct type, and are specified in the right order.
comply以命令行和视觉工作室内部构建良好。  Microsoft.extensions.configuration.binder并未直接使用该错误时正在编译的项目(两个都是Net48项目)。
我可以解决此问题(除了恢复到Microsoft.extensions.configuration.binder的先前版本外)?

从错误消息,

Microsoft.extensions.configuration.binderpackage的版本9.0.1版本中包含文件
msbuild
1个回答
0
投票
Microsoft.Extensions.Configuration.Binder.targets

,该文件在第20行上使用[MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netcoreapp2.0').

v7.0.4之后,添加了.targets文件。作为定格,看来您可以通过更改使用Microsoft.extensions.configuration.binder软件包来解决错误。 在MSBUILD V16.7中添加了the propertion函数。我认为正在发生MSB4186错误,因为您正在使用v16.7.
之前的MSBUILD版本。
MSBUILD与Visual Studio和Visual Studio的版本轨道分发。 MSBUILD v16.7与Visual Studio 2019v16.7.

分发。 this信息:

[MSBuild]::IsTargetFrameworkCompatible

是关于名为

Task         : MSBuild
Description  : Build with MSBuild
Version      : 1.179.0
Author       : Microsoft Corporation
并调用MSBuild

的Azure Devops管道任务。 “

MSBuild

”是管道任务的版本,而不是msbuild的版本。

管道任务将找到Visual Studio安装目录,并使用Visual Studio安装中的MSBUILD。该任务的日志可能包括有关MSBUILD调用实例的信息,您可以确认正在使用较旧版本的MSBuild。

可能需要更新构建代理的主机,以至少拥有Visual Studio 2019v16.7
.
的构建工具。

(请注意,vs 2019 16.7.0于2020年8月发布 - 大约4。5年前,在撰写本文时。如果构建主机过时多年,那么仅更新安全/漏洞修复就很重要。)

	
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.