Skip to content

Confusing error when non .NET sdk has no compatible targets #51930

@pheeblyboos

Description

@pheeblyboos

Describe the bug

This bug occurred in one of our workflows when the runner updated to .NET 10. See Exceptions for the error message.
The "bug" being that this message is very vague and doesn't point toward the actual cause of the problem. My assumption is that this error is thrown because the Sql package doesn't relate to NETCoreAppMaximumVersion (but I'm not sure).
When I commented out the UnsupportedTargetFrameworkVersion attribute in the Microsoft.NET.SupportedTargetFrameworks.props file. It gave me an error that made much more sense and made it very easy to understand what actually was the problem and I could update the sql SDK:

C:\Users\User\.nuget\packages\microsoft.build.sql\1.0.0-rc1\Sdk\Sdk.targets(60,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\10.0.100\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets" was not found. Confirm that the expression in the Import declaration "$(MSBuildSdksPath)/NuGet.Build.Tasks.Pack/build/NuGet.Build.Tasks.Pack.targets", which evaluated to "C:\Program Files\dotnet\sdk\10.0.100\Sdks/NuGet.Build.Tasks.Pack/build/NuGet.Build.Tasks.Pack.targets", is correct, and that the file exists on disk.

So I'm wondering if it was taken into account that there can also be different SDK packages than just base .NET sdks?

To Reproduce

Create a Database project that has an tag with Microsoft.Build.Sql that does not support .NET 10 (for example <Sdk Name="Microsoft.Build.Sql" Version="1.0.0-rc1" />)

Exceptions (if any)

C:\Program Files\dotnet\sdk\10.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.SupportedTargetFrameworks.props(36,9): error MSB4186: Invalid static method invocation syntax: "[MSBuild]::Add($(NETCoreAppMaximumVersion), 1)". Method '[MSBuild]::Add' 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.

Further technical details

details of dotnet --info

.NET SDK: Version: 10.0.100 Commit: b0f34d51fc Workload version: 10.0.100-manifests.355811b7 MSBuild version: 18.0.2+b0f34d51f

Runtime Environment:
OS Name: Windows
OS Version: 10.0.26200
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.100\

.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.

Host:
Version: 10.0.0
Architecture: x64
Commit: b0f34d51fc

.NET SDKs installed:
9.0.307 [C:\Program Files\dotnet\sdk]
10.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 8.0.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
Not set

global.json file:
Not found

- The IDE (VS / VS Code/ VS4Mac) you're running on, and its version - .NET 10.0.100

Metadata

Metadata

Assignees

Labels

untriagedRequest triage from a team member

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions