Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to harvest CsWinRT projection WinMD files in single-project NET8 app for ActivatableClass #4799

Open
AliveDevil opened this issue Oct 11, 2024 · 2 comments

Comments

@AliveDevil
Copy link

What's the recommended way of automatically harvesting the WinRT definitions from NuGet referenced WinMD files.

Current situation:
I have several NuGet packages that provide - for .net8 - a CsWinRT projection. This has a lib/net8.0-windows10/Component.Projection.dll.
In that NuGet package for uap10 and netstandard2.0 support I included the WinMD file as a copy.
On .NET8 I have a targets file with ItemGroup <CsWinRTInclude Include="..\..\lib\netstandard2.0\Component.winmd" />.

As this is not part of either the <Reference>-group, nor available anywhere else, what's the intended way to consume a CsWinRT projection library, while not having to manually include all ActivatableClass-definitions in the AppX manifest?
I tried with

<ItemGroup>
    <WinMDFullPath Include="..\..\netstandard2.0\Component.winmd" />
</ItemGroup>

But that doesn't work.

@RDMacLachlan
Copy link
Member

@manodasanW can you investigate, or move this Issue to the appropriate repo for discussion (https://github.com/microsoft/CsWinRT).

@AliveDevil
Copy link
Author

AliveDevil commented Oct 14, 2024

additional info:
As a workaround I am setting CsWinRTInputs for CsWinRT, and statically adding the WinMD through a ReferenceCopyLocalPaths-item (including Implementation-metadata), so the WinMD isn’t swallowed by CsWinRT and copied to the OutputDirectory, as CsWinRT eliminates these as well (which completely invalidates stuff like winrt::create_instance, will add more details here later), this item also results in WindowsAppSdk harvesting the WinMD and creating necessary Package-manifest entries.
Which isn’t ideal.

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

No branches or pull requests

2 participants