microsoft / CsWin32

A source generator to add a user-defined set of Win32 P/Invoke methods and supporting types to a C# project.
MIT License
1.99k stars 84 forks source link

Drop the implicit `System.Memory` reference from the package #1172

Closed AArnott closed 2 months ago

AArnott commented 2 months ago

Because we advise users to set PrivateAssets=all on the CsWin32 package itself, its transitive dependencies don't pass through to the CsWin32 user's own consumers, leading to compilation or binding redirect issues because System.Memory is missing. By dropping it from the package itself and requiring CsWin32 users to reference it directly, we put a bit more responsibility on them but solve the problem of the missing reference.

To help users get this right, we report a new warning when System.Memory hasn't been referenced.

Fixes #1158