Skip to content

Bad error message when referencing a non-SDK multitargeting project  #10629

@rainersigwald

Description

@rainersigwald

Given a .NET Framework project (non-SDK) referenced by any project, (erroneously) add

	  <TargetFrameworks>net46;net8.0</TargetFrameworks>

to try to make it multitarget. That is ignored by the non-SDK common targets, so the individual project can build, but the referencing project fails before RPR, leaving you with

> msbuild -bl
  ClassLibrary2 succeeded (0.1s) → ClassLibrary2\bin\Debug\ClassLibrary2.dll
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
  ClassLibrary2 failed with 1 error(s) (0.0s)
    C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(1967,5): error : Internal MSBuild error: Non-CrossTargeting GetTargetFrameworks target should not be used in cross targeting (outer) build

Build failed with 1 error(s) in 0.6s

That error isn't wrong but it sure doesn't help you fix the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: DebuggabilityIssues impacting the diagnosability of builds, including logging and clearer error messages.Priority:3Work that is nice to havebacklogtriaged

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions