Skip to content

Include .winmd in nuget and enable C++ usage#40601

Merged
JohnMcPMS merged 9 commits into
microsoft:masterfrom
JohnMcPMS:winmd-nuget
May 20, 2026
Merged

Include .winmd in nuget and enable C++ usage#40601
JohnMcPMS merged 9 commits into
microsoft:masterfrom
JohnMcPMS:winmd-nuget

Conversation

@JohnMcPMS
Copy link
Copy Markdown
Member

Summary of the Pull Request

Update the WSLC SDK nuget package for C++ usage.

PR Checklist

  • Closes: Link to issue #xxx
  • Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • Tests: Added/updated if needed and all pass
  • Localization: All end user facing strings can be localized
  • Dev docs: Added/updated if needed
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

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 Reference for C++/WinRT to consume and generate headers for. Adds a fusion manifest fragment to allow RoGetActivationFactory to 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.

@JohnMcPMS JohnMcPMS requested a review from a team as a code owner May 20, 2026 00:12
Copilot AI review requested due to automatic review settings May 20, 2026 00:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.winmd to 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 .winmd artifact.

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.

Comment thread src/windows/WslcSDK/winrt/CMakeLists.txt Outdated
yao-msft
yao-msft previously approved these changes May 20, 2026
Copy link
Copy Markdown
Member

@benhillis benhillis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good, do .winmd files need to be signed?

@JohnMcPMS
Copy link
Copy Markdown
Member Author

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.

Copilot AI review requested due to automatic review settings May 20, 2026 01:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Comment thread .pipelines/build-stage.yml Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 20, 2026 03:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown
Member

@benhillis benhillis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signing off, imo anything we ship we should probably sign, but we can do that in a follow-up.

@JohnMcPMS
Copy link
Copy Markdown
Member Author

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.

@JohnMcPMS JohnMcPMS merged commit 43f78f4 into microsoft:master May 20, 2026
13 checks passed
@JohnMcPMS JohnMcPMS deleted the winmd-nuget branch May 20, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants