dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.7k stars 1.06k forks source link

Method '[MSBuild]::GetTargetFrameworkIdentifier' not found #14106

Open praeclarum opened 4 years ago

praeclarum commented 4 years ago

I get the following error from Visual Studio for Mac when restoring packages after installing .NET5 RC2.

Getting restore information for project /Users/fak/Dropbox/Projects/Circuit2/Circuit/Circuit2.csproj
/usr/local/share/dotnet/sdk/5.0.100-rc.2.20480.7/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(54,5) : error MSB4186: Invalid static method invocation syntax: "[MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')". Method '[MSBuild]::GetTargetFrameworkIdentifier' 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.
Unable to create package spec for project. '/Users/fak/Dropbox/Projects/Circuit2/Circuit/Circuit2.csproj'

error MSB4186: Invalid static method invocation syntax

This project is a Xamarin.iOS app that uses <PackageReference> for nuget.

=== Visual Studio Enterprise 2019 for Mac ===

Version 8.7.8 (build 4)
Installation UUID: dfc4e69f-8ae0-4701-b7e2-028b0b071e13
    GTK+ 2.24.23 (Raleigh theme)
    Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)

    Package version: 612000093

=== Mono Framework MDK ===

Runtime:
    Mono 6.12.0.93 (2020-02/620cf538206) (64-bit)
    Package version: 612000093

=== Roslyn (Language Service) ===

3.7.0-6.20427.1+18ede13943b0bfae1b44ef078b2f3923159bcd32

=== NuGet ===

Version: 5.7.0.6702

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/5.0.100-rc.2.20480.7/Sdks
SDK Versions:
    5.0.100-rc.2.20480.7
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
    5.0.0-rc.2.20475.5

=== Updater ===

Version: 11

=== Xamarin.iOS ===

Version: 14.7.0.78 (Visual Studio Enterprise)
Hash: 035042845
Branch: frank-catalyst2
Build date: 2020-10-10 14:03:31-0700

=== Operating System ===

Mac OS X 10.15.6
Darwin 19.6.0 Darwin Kernel Version 19.6.0
    Sun Jul  5 00:43:10 PDT 2020
    root:xnu-6153.141.1~9/RELEASE_X86_64 x86_64
zlepper commented 3 years ago

We are also seeing this, however we are compiling against windows, on windows:

[Step 9/12]  29:11>C:\Program Files\dotnet\sdk\5.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(54,5): error MSB4186: Invalid static method invocation syntax: "[MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')". Method '[MSBuild]::GetTargetFrameworkIdentifier' not found. Static method invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(`a`, `b`)).  [C:\BuildAgent\work\40be139df87d45a2\DAMCenter\Messaging\Digizuite.Messaging.Shared\Digizuite.Messaging.Shared.csproj]

And the strange thing is, it seems to only happen on one of our build machines, not all of them.

theolivenbaum commented 3 years ago

Saw a similar issue when upgrading my C# to JS compiler: https://github.com/dotnet/msbuild/issues/5875

marcpopMSFT commented 3 years ago

https://github.com/mono/mono/issues/20250

jhofer commented 3 years ago

Had the same issue local on my mac. After updating VS2019 to the latest version the error was gone

rainersigwald commented 1 year ago

Has anyone seen this recently? It sounds like a Visual Studio for Mac update may have helped.