Include .winmd in nuget and enable C++ usage#40601
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the Microsoft.WSL.Containers SDK NuGet packaging/build integration to ship the WinRT metadata (.winmd) and enable C++/WinRT consumption (including activation via an injected manifest fragment).
Changes:
- Copies the generated
wslcsdk.winmdto a stable bin output name (Microsoft.WSL.Containers.winmd) for packaging. - Adds a WinRT activatable class manifest fragment and injects it into consuming native builds (opt-out via
WslcEnableCppWinRT). - Updates the NuGet spec and CI pipelines to include/stage the
.winmdartifact.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/windows/WslcSDK/winrt/CMakeLists.txt | Post-build copies the generated WinMD into the bin layout used by NuGet packaging. |
| nuget/Microsoft.WSL.Containers/manifests/Microsoft.WSL.Containers.manifest | Adds a manifest fragment enumerating WinRT activatable classes in wslcsdk.dll. |
| nuget/Microsoft.WSL.Containers/build/native/Microsoft.WSL.Containers.targets | Adds a WinMD reference for C++/WinRT and injects the manifest fragment into native builds (toggle via WslcEnableCppWinRT). |
| nuget/Microsoft.WSL.Containers.nuspec.in | Includes Microsoft.WSL.Containers.winmd in the produced NuGet package. |
| .pipelines/package-stage.yml | Stages the .winmd into the expected per-arch bin layout during packaging. |
| .pipelines/build-job.yml | Publishes the .winmd into the per-arch SDK artifact drop. |
benhillis
left a comment
There was a problem hiding this comment.
Looks pretty good, do .winmd files need to be signed?
They can be. It is possible that someone would want to include this one in their app if they need to marshal any of objects, but it isn't required. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
benhillis
left a comment
There was a problem hiding this comment.
Signing off, imo anything we ship we should probably sign, but we can do that in a follow-up.
I tried to update the PR to do it, but I'm not sure if I did so correctly. Will double check the nuget from the next release build for signed binaries all around. |
Summary of the Pull Request
Update the WSLC SDK nuget package for C++ usage.
PR Checklist
Detailed Description of the Pull Request / Additional comments
Pipe the Microsoft.WSL.Containers winmd file through the build system and include it in the nuget package. Update the native targets to include a
Referencefor C++/WinRT to consume and generate headers for. Adds a fusion manifest fragment to allowRoGetActivationFactoryto find the dll for the activatable types. Adds a property (WslcEnableCppWinRT) to disable all of this for pure C SDK usage.Validation Steps Performed
Tested through a locally built nuget and sample project.