Invalid static method invocation syntax: "[MSBuild]::VersionLessThanOrEquals('$(TargetFrameworkVersion)', '2.0')". Method '[MSBuild]::VersionLessThanOrEquals' not found.

Apati, Ashok 25 Reputation points
2023-08-28T00:28:25.4166667+00:00

Hi Team, I have made code changes and everything is working as expected in locally but when i try to run same code in Azure DevOps pipeline getting build error.

Here is the following error I got. Please help is something need to update in Azure DevOps

C:\Windows\ServiceProfiles\NetworkService.nuget\packages\microsoft.extensions.apidescription.server\6.0.5\build\Microsoft.Extensions.ApiDescription.Server.targets(5,38): error MSB4186: Invalid static method invocation syntax: "[MSBuild]::VersionLessThanOrEquals('$(TargetFrameworkVersion)', '2.0')". Method '[MSBuild]::VersionLessThanOrEquals' 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.

Community Center Not monitored
{count} votes

1 answer

Sort by: Most helpful
  1. Muppalmani, Bhavani 0 Reputation points
    2023-09-07T16:17:38.83+00:00

    Our process was using Nuget.exe latest version. We had to move back to previous version to get this resolved.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.