Repository navigation
Description
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.propsExpected 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.
- 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
TargetFrameworkglobal property._WalkEachTargetPerFrameworkcalls_GetTfmSpecificContentForPackageon the instance that is packing. - For a tool,
TargetsForTfmSpecificContentInPackageincludesPackTool, andPackTooldepends onPublish. - The publish runs
_CleanupReferencedProjectItemGroupsbeforeGetCopyToPublishDirectoryItems, and it removes every asset of the build manifest fromContent. That now includes the itemsIncludeStaticWebAssetsPackItemsadded withPack="true"earlier in the sameGenerateNuspecchain. _GetPackageFilesthen readsContentwithout 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
github-actions commentedon Nov 16, 2026
🎯 Agentic Issue Triage
Triage Assessment:
@javiercn| @dotnet/aspnet-blazor-enghigh- 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.
The .NET 11 workarounds name the upstream issues that remove them
The container workarounds name the SDK issues that remove them