Share via

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

Apati, Ashok 25 Reputation points
Aug 28, 2023, 12:28 AM

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.

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
43,158 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Muppalmani, Bhavani 0 Reputation points
    Sep 7, 2023, 4:17 PM

    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.