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

Share System.Private.Windows.Core with WPF #12179

Open
JeremyKuhne opened this issue Sep 19, 2024 · 3 comments
Open

Share System.Private.Windows.Core with WPF #12179

JeremyKuhne opened this issue Sep 19, 2024 · 3 comments
Milestone

Comments

@JeremyKuhne
Copy link
Member

This core assembly has no dependencies. It provides helpful interop utilities and would allow sharing common functionality such as clipboard implementations.

As it is already available for WPF compilation, the initial plan is to add internals visible to for WPF assemblies and just consume it.

Vetting can be done by updating dotnet/wpf#7929 to use the shared code.

We'll likely want to move more CsWin32 imports and helper code down from System.Windows.Forms.Primitives.

@ThomasGoulet73
Copy link

Would it be better to make System.Private.Windows.Core public but without a ref assembly instead of using InternalsVisibleTo ?

It would then be "hidden" from projects referencing the WindowsDesktop pack but WPF would still be able to use it.

AFAIK InternalsVisibleTo is avoided when possible because it can cause issues with trimming. See dotnet/runtime#107848 for an example.

@AustinWise
Copy link
Contributor

If WPF starts using System.Private.Windows.Core, the runtime pack needs to be updated to include it when publishing by updating it's profile here to be WindowsForms;WPF:

https:/dotnet/windowsdesktop/blob/main/src/windowsdesktop/src/sfx/Microsoft.WindowsDesktop.App.Runtime.sfxproj#L45

@RussKie
Copy link
Member

RussKie commented Oct 4, 2024

If WPF starts using System.Private.Windows.Core, the runtime pack needs to be updated to include it when publishing by updating it's profile here to be WindowsForms;WPF:

dotnet/windowsdesktop@main/src/windowsdesktop/src/sfx/Microsoft.WindowsDesktop.App.Runtime.sfxproj#L45

Looks like that file (or the WindowsDesktop SDK) was refactored at some point, which lost the import and made the manual intervention necessary. This is wrong.
Windows Forms repo maintains and owns that list, and it is located here:

<!--
This props file comes from dotnet/winforms. It gets ingested by dotnet/windowsdesktop and processed by
pkg\windowsdesktop\sfx\Microsoft.WindowsDesktop.App.Ref.sfxproj.
-->
<Project>
<ItemGroup Condition="'$(PackageTargetRuntime)' == ''">
<FrameworkListFileClass Include="Microsoft.VisualBasic.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="Microsoft.VisualBasic.Forms.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Design.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Drawing.Common.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Drawing.Design.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Drawing.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Private.Windows.Core.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Windows.Forms.Analyzers.CodeFixes.CSharp.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Windows.Forms.Analyzers.CodeFixes.VisualBasic.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Windows.Forms.Analyzers.CSharp.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Windows.Forms.Analyzers.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Windows.Forms.Analyzers.VisualBasic.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Windows.Forms.Design.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Windows.Forms.Design.Editors.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Windows.Forms.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Windows.Forms.Primitives.dll" Profile="WindowsForms" />
</ItemGroup>
</Project>

The docs are here: https:/dotnet/winforms/tree/main/pkg/Microsoft.Private.Winforms#sdkdotnet-windowsdesktop-folder

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

4 participants