-
Notifications
You must be signed in to change notification settings - Fork 105
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
CsWinRT not removing WinMD references from deps.json (CoreCLR, 0x80070057) #1811
Comments
Looking at the binlog: |
You shouldn't add the WinMD into the |
Well, the use case is: There is another WinRT component, that has a PackageReference to the first WinRT component, which is exposed by another CsWinRT projection. This won't work, as CsWinRT doesn't find the type information for the first WinRT component in the NuGet package, because it's nowhere to be found, the guidance previously was to just include it in the lib/-folder (see linked issue). Additionally, when including the WinRT in the lib/-folder the AppHost crashes immediately on startup, as it validates that there are no winmd-files referenced n the deps.json or side-by-side with the startup application. This abomination of a nuspec works, but I see this as highly counter-intuitive:
With the So, to make sure, that .NET Sdk doesn't include the winmd as a runtime artifact, the winmd file must not end up in lib/, but for CsWinRT to realize there are consumable WinMD files, one has to duplicate the projection Dll into ref/, including the WinMD:
With:
|
What I'd recommend you do is to put the WinMD somewhere else, then add the |
With CsWinRTInputs there is another bad interaction with WindowsAppSdk, where target |
Describe the bug
When referencing a NuGet package that includes for further CsWinRT referencing a .winmd file in net8.0-windows10.X subsequent launches of the application will fail (i.e. Projection B references Projection A, because Component B uses types from Component A).
To Reproduce
NuSpec file:
Create a console application, that references this Nuget package.
The deps.json will include the .winmd files, resulting in the .NET 8 host to fail with
Expected behavior
As mentioned here I expect this to seamlessly just work and not crash the CoreCLR runtime immediately.
Version Info
CsWinRT: 2.1.5
Additional context
Repro: CsWinRTNuGet.zip
Follow steps in embedded readme.md.
My workaround is to move the winmd to lib/netstandard2.0, then create a package build/net8.0-windows10.X/build.props file, that adds a reference to the netstandard2.0 winmd, which does get collected later.
This has the bad sideeffect, that Visual Studio complains about a non-existing file (the MSBuildThisFileDirectory macro doesn't resolve while a project is loaded).
The text was updated successfully, but these errors were encountered: