Skip to content

How to choose .NET Core SDK version? #96

@dedale

Description

@dedale

Cf. dotnet/msbuild#5706

Since the setup of VS 16.8 Preview, apps and unit tests depending on MSBuild seem to use .NET Core SDK 5.0.

After calling MSBuildLocator.RegisterDefaults();
I only have one VisualStudioInstance in MSBuildLocator.QueryVisualStudioInstances():

.NET Core SDK 5.0.100 C:\Program Files\dotnet\sdk\5.0.100-preview.8.20417.9\

Then, loading a .NET Core SDK project fails:

Microsoft.Build.Exceptions.InvalidProjectFileException : 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.
C:\Program Files\dotnet\sdk\5.0.100-preview.8.20417.9\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets

If I temporarily remove .NET Core SDK 5.0 folder, everything works fine. Instance loaded is:

.NET Core SDK 3.1.401 C:\Program Files\dotnet\sdk\3.1.401\

Thanks in advance for you help

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions