Skip to content

SDK 11.0.100: pack of a single-targeted PackAsTool web project leaves its static web assets out of the package, while the manifest still names them #57154

Open
quartznet/quartznet
#4354

Description

@lahma

Describe the bug

With SDK 11.0.100, dotnet pack of a Web SDK project that has PackAsTool and a single TargetFramework gives a package whose static web assets manifest names staticwebassets/app.js, while the package has no staticwebassets/ folder. SDK 10.0.404 packs the file.

The manifest is build/Microsoft.AspNetCore.StaticWebAssets.props for a net10.0 project and build/<PackageId>.PackageAssets.json for a net11.0 one; both show the same gap.

The installed tool still runs, because tools/<tfm>/any/wwwroot/ is complete. What breaks is the package's own consistency: it lists files it does not carry. A package content check in Quartz.NET caught it when that repository moved to the .NET 11 SDK (quartznet/quartznet#4347).

Steps to reproduce

Three files in one folder.

Tool.csproj:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net10.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <IsPackable>true</IsPackable>
    <PackAsTool>true</PackAsTool>
  </PropertyGroup>

</Project>

Program.cs:

WebApplication app = WebApplication.CreateBuilder(args).Build();
app.MapStaticAssets();
app.Run();

wwwroot/app.js:

console.log("app");

Then, with a global.json in the parent folder that selects the SDK:

dotnet pack -o out
unzip -l out/Tool.1.0.0.nupkg
unzip -p out/Tool.1.0.0.nupkg build/Microsoft.AspNetCore.StaticWebAssets.props

Expected behavior

The package of SDK 10.0.404, which carries the file its manifest names:

build/Microsoft.AspNetCore.StaticWebAssetEndpoints.props
build/Microsoft.AspNetCore.StaticWebAssets.props
build/Tool.props
buildMultiTargeting/Tool.props
buildTransitive/Tool.props
staticwebassets/app.js
tools/net10.0/any/DotnetToolSettings.xml
tools/net10.0/any/Tool.dll
...
tools/net10.0/any/wwwroot/app.js
tools/net10.0/any/wwwroot/app.js.br
tools/net10.0/any/wwwroot/app.js.gz

Leaving the manifest out of a tool package altogether would be consistent too.

Actual behavior

SDK 11.0.100 gives the same listing without staticwebassets/app.js:

build/Microsoft.AspNetCore.StaticWebAssetEndpoints.props
build/Microsoft.AspNetCore.StaticWebAssets.props
build/Tool.props
buildMultiTargeting/Tool.props
buildTransitive/Tool.props
tools/net10.0/any/DotnetToolSettings.xml
tools/net10.0/any/Tool.dll
...
tools/net10.0/any/wwwroot/app.js
tools/net10.0/any/wwwroot/app.js.br
tools/net10.0/any/wwwroot/app.js.gz

build/Microsoft.AspNetCore.StaticWebAssets.props still names the file, as it does in the SDK 10 package:

<StaticWebAsset Include="$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\staticwebassets\app.js'))">
  <SourceType>Package</SourceType>
  <SourceId>Tool</SourceId>
  <ContentRoot>$(MSBuildThisFileDirectory)..\staticwebassets\</ContentRoot>
  ...

Variants, all on SDK 11.0.100:

Project staticwebassets/app.js in the package
PackAsTool, <TargetFramework>net10.0</TargetFramework> missing
PackAsTool, <TargetFramework>net11.0</TargetFramework> missing, and build/Tool.PackageAssets.json names it
PackAsTool, <TargetFrameworks>net10.0</TargetFrameworks> present
no PackAsTool, <TargetFramework>net11.0</TargetFramework> present

Is this a regression?

Yes. The same project packs correctly with SDK 10.0.404.

Are there any workarounds?

Either of these, both checked on the project above:

  • Use <TargetFrameworks>net10.0</TargetFrameworks> in place of <TargetFramework>.

  • Put the items back before NuGet collects the package files:

    <Target Name="RestoreStaticWebAssetsPackItems" BeforeTargets="_GetPackageFiles" Condition="'@(_StaticWebAssetsFilesToPack)' != ''">
      <ItemGroup>
        <Content Remove="@(_StaticWebAssetsFilesToPack)" />
        <Content Include="@(_StaticWebAssetsFilesToPack)" Pack="true" CopyToOutputDirectory="Never" CopyToPublishDirectory="Never" />
      </ItemGroup>
    </Target>

dotnet --info output

.NET SDK:
 Version:           11.0.100
 Commit:            297acf930f
 MSBuild version:   18.12.2-1.26529.118+297acf930

Runtime Environment:
 OS Name:     Windows
 RID:         win-x64

Host:
  Version:      11.0.0
  Commit:       297acf930f

Also reproduced in mcr.microsoft.com/dotnet/sdk:11.0 (Ubuntu 26.04.1, x64) with the net11.0 variant.

IDE version

Not used; command line only.

Other details

Cause. The chain below is read from the targets, and the item removal is confirmed by messages printed before and after the cleanup target.

  1. Since Re-implement Pack: reuse existing evaluations instead of forcing BuildProjectReferences=false NuGet/NuGet.Client#7603, a single-targeted project is no longer packed through an inner instance with a TargetFramework global property. _WalkEachTargetPerFramework calls _GetTfmSpecificContentForPackage on the instance that is packing.
  2. For a tool, TargetsForTfmSpecificContentInPackage includes PackTool, and PackTool depends on Publish.
  3. The publish runs _CleanupReferencedProjectItemGroups before GetCopyToPublishDirectoryItems, and it removes every asset of the build manifest from Content. That now includes the items IncludeStaticWebAssetsPackItems added with Pack="true" earlier in the same GenerateNuspec chain.
  4. _GetPackageFiles then reads Content without them. The generated manifest files are not static web assets, so they stay.

With SDK 10, and still with TargetFrameworks, steps 2 and 3 run in a per-framework instance, so the Content of the instance that packs is untouched.

The messages, from targets hooked before and after _CleanupReferencedProjectItemGroups and before _GetPackageFiles (generated file names shortened):

BEFORE cleanup, Content with Pack=true: app.js;...StaticWebAssetEndpoints.props;...StaticWebAssets.props;...
AFTER cleanup, Content with Pack=true: ...StaticWebAssetEndpoints.props;...StaticWebAssets.props;...
AT _GetPackageFiles, _StaticWebAssetsFilesToPack: app.js;... / Content with Pack=true: ...StaticWebAssetEndpoints.props;...

Why here. NuGet's change made the instance shared, but the target that removes the items and the tool's pack-time publish are both in this repository, so I filed it here. It may equally be seen as NuGet's to guard against.

I found no existing report in dotnet/sdk, NuGet/Home, NuGet/NuGet.Client or dotnet/aspnetcore.

Activity

  1. added
    untriaged
    on Nov 16, 2026
  2. locked and limited conversation to collaborators on Nov 16, 2026
  3. unlocked this conversation on Nov 16, 2026
  4. added and removed
    untriaged
    on Nov 16, 2026
  5. github-actions commented on Nov 16, 2026

    @github-actions
    Contributor

    🎯 Agentic Issue Triage

    Triage Assessment:

    • 🏷️ Labels: Area-StaticWebAssets Bug
    • 💻 Assignment: @javiercn | @dotnet/aspnet-blazor-eng
    • 🟩 Confidence: high - The report directly identifies static web assets pack behavior and the CODEOWNERS section is unambiguous.

    ➡️ Summary: In SDK 11.0.100, packing a single-targeted PackAsTool web project omits staticwebassets files while the manifest still lists them. Owners should review how publish cleanup removes pack Content items.

    Generated by 🏷️ Issue Triage for #57154 · copilot · auto (Claude Sonnet 5.5) · ~15 AIC · ⌖ ~2 AIC · ⊞ 15.4K · ◷

  6. added
    untriaged
    on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Area-StaticWebAssetsBuguntriaged

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions