Skip to content

Do NOT set PackageId when project has IsPackable=false #14928

Description

@kzu

NuGet Product(s) Affected

NuGet SDK

Current Behavior

NuGet.Build.Tasks.Pack.targets unconditionally sets PackageId to AssemblyName:

<PackageId Condition=" '$(PackageId)' == '' ">$(AssemblyName)</PackageId>

Now that (as of .NET 10 at least), these pack targets are imported from the SDK itself (and last), it's virtually impossible to get a project with NO PackageId. See https://github.com/dotnet/sdk/blob/main/src/Tasks/Microsoft.NET.Build.Tasks/sdk/Sdk.targets#L48-L54

Desired Behavior

Do not force a PackageId on every project, in particular if the project explicitly sets IsPackable=false.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions