Skip to content

NETSDK1013 when mixing TargetFramework and TargetFrameworks with GeneratePackageOnBuild #1330

@adc-wnorvelle

Description

@adc-wnorvelle

Error

C:\Program Files\dotnet\sdk\10.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(109,5): error NETSDK1013: The TargetFramework value '' was not recognized. It may be misspelled. If not, then the TargetFrameworkIdentifier and/or TargetFrameworkVersion properties must be specified explicitly.

In larger solutions, this also generates:
The "MSBuild" task returned false but did not log an error

Trigger Conditions

  • Project 1 depends on Project 2
  • Project 1 sets TargetFrameworks (actual number of frameworks does not matter)
  • Project 1 sets GeneratePackageOnBuild to true
  • Project 2 sets TargetFramework
  • Both projects use Nerdbank.GitVersioning
  • Build in Visual Studio

Reproduction Repository

multitfm-NETSDK1013-Nerdbank.GitVersioning-repro

Environment

  • Nerdbank.GitVersioning version: 3.9.50 (also affects 3.10.8-alpha)
  • .NET SDK: 10.0.101
  • IDE: Verified in Visual Studio 2022 & Visual Studio 2026
  • OS: Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions