Skip to content

GenerateLibraryLayout puts content in a second lib folder for 4-part Windows TFMs (net10.0-windows10.0.19041.0) #24873

Open

Description

@MartinZikmund

Current behavior 🐛

When a class library sets GenerateLibraryLayout=true and targets a 4-part Windows TFM (net10.0-windows10.0.19041.0), dotnet pack/msbuild -t:Pack produces two lib/ folders for the Windows target:

lib/net10.0-windows10.0.19041.0/MyLib/Assets/hello.json   <-- content only, no assembly
lib/net10.0-windows10.0.19041/MyLib.dll                   <-- where NuGet puts the assembly
lib/net10.0-windows10.0.19041/MyLib.pri
lib/net10.0/MyLib.dll
lib/net10.0/MyLib.uprimarker
lib/net10.0/MyLib/Assets/hello.json

NuGet normalizes the 4-part TFM when it places the assembly (net10.0-windows10.0.19041, trailing .0 dropped). The layout target that adds the library content uses the raw $(TargetFramework) string, so the content ends up in a different, assembly-less folder. The package installs fine, but the content for the Windows TFM is not next to the assembly where NuGet resolves it, and anything walking lib/<tfm>/ for that TFM will miss it (this was noticed on Lottie assets in a theme library).

Expected behavior 🎯

All files for the Windows TFM live in the same lib/ folder as its assembly (lib/net10.0-windows10.0.19041/...), the same way they do when the project uses the 3-part TFM.

How to reproduce it (as minimally and precisely as possible) 🔬

  1. Install Visual Studio (full MSBuild.exe is required, dotnet pack refuses a WinUI library with XAML, UNOB0008) and add a global.json pointing at the dev Uno SDK:
    { "msbuild-sdks": { "Uno.Sdk.Private": "7.0.0-dev.1432" } }
    with the Uno dev feed (https://uno-platform.pkgs.visualstudio.com/Uno%20Platform/_packaging/unoplatformdev/nuget/v3/index.json) in nuget.config.
  2. Create MyLib/MyLib.csproj:
    <Project Sdk="Uno.Sdk.Private">
      <PropertyGroup>
        <TargetFrameworks>net10.0;net10.0-windows10.0.19041.0</TargetFrameworks>
        <OutputType>Library</OutputType>
        <GenerateLibraryLayout>true</GenerateLibraryLayout>
        <PackageId>MyLib</PackageId>
        <Version>1.0.0</Version>
      </PropertyGroup>
      <ItemGroup>
        <Content Include="Assets\hello.json" />
      </ItemGroup>
    </Project>
  3. Add Assets/hello.json (content {}), a C.cs with namespace MyLib; public class C { }, and a Theme.xaml ResourceDictionary (any XAML, so the WinUI packaging path runs).
  4. Run MSBuild.exe MyLib.csproj -restore -t:Pack -p:Configuration=Release -p:IsPackable=true.
  5. List the lib/ entries of bin/Release/MyLib.1.0.0.nupkg. You get the two Windows folders shown above.
  6. Change the TFM to net10.0-windows10.0.19041 (3-part) and repeat: a single lib/net10.0-windows10.0.19041/ folder with the DLL, .pri and Assets/hello.json.

(Side note from the repro: with the 10.0.401 SDK WinRT.Runtime conflicts needed -p:WindowsSdkPackageVersion=10.0.19041.87 to compile. That is unrelated to the packaging behavior.)

Workaround 🛠️

Use the 3-part TFM net10.0-windows10.0.19041 instead of net10.0-windows10.0.19041.0.

Renderer 🎨

N/A (packaging only; affects the Windows / WinAppSDK target)

Affected platforms 📱💻🖥️

Windows (WinAppSDK TFM, SDKIdentifier == Windows)

Uno.Sdk version (and other relevant versions) 📦

Uno.Sdk.Private 7.0.0-dev.1432, .NET SDK 10.0.401, MSBuild from Visual Studio 18 Insiders. Source references are at master commit 47267e7.

IDE version 🧑‍💻

Command line (MSBuild.exe), Visual Studio 18 Insiders installed.

Anything else we need to know? 💬

Root cause: the Windows branch of the layout target builds the package path from the raw TFM string:

<Target Name="_UnoSdkIncludeWindowsLibraryLayoutItems"
DependsOnTargets="PrepareLibraryLayout"
Condition="'$(GenerateLibraryLayout)' == 'true' AND '$(SDKIdentifier)' == 'Windows' AND '$(_ExtrasSdkHasDesktopAppSupport)'==''">
<ItemGroup>
<TfmSpecificPackageFile Include="@(_LayoutFile)"
Condition="'$(ProjectName)' == '%(_LayoutFile.ProjectName)'"
PackagePath="lib\$(TargetFramework)\%(_LayoutFile.TargetPath)"/>
</ItemGroup>
</Target>

<TfmSpecificPackageFile Include="@(_LayoutFile)"
                        Condition="'$(ProjectName)' == '%(_LayoutFile.ProjectName)'"
                        PackagePath="lib\$(TargetFramework)\%(_LayoutFile.TargetPath)"/>

Suggested fix: compute the folder the same way NuGet does (drop the trailing .0 of a 4-part Windows platform version) instead of using $(TargetFramework) verbatim. The non-Windows branch in uno.ui.tasks.assets.targets (_UnoIncludeLibraryAssets) builds its path from $(TargetFramework) + the platform version too, so it is worth a look while there.

Activity

  1. added
    kind/bug
    triage/untriaged
    area/build
    project/core-tools 🛠️
    difficulty/starter 🚀
    area/sdk
    on Oct 1, 2026
  2. added
    7.1
    on Oct 14, 2026
  3. removed
    7.1
    on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/buildarea/sdkdifficulty/starter 🚀kind/bugproject/core-tools 🛠️triage/untriaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions