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

Multi-target .NET Framework 4.8 and .NET 8 #3745

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Morilli
Copy link
Collaborator

@Morilli Morilli commented Aug 17, 2023

This is a proof-of-concept PR multi-targeting both .NET Framework and .NET 8.
.NET 5+ has lots of performance improvements that could immediately benefit us (e.g. #3675).
.NET 5+ does not support WinForms under linux, which means that the .NET Framework version can be used under linux and windows, while the .NET 5+ build is windows-only.

This is still very much at POC level as there will most likely be unexpected issues like differing APIs, dialogs being visually broken etc. Also, no script and command is currently aware of the output folder change: output/[everything] -> output/net4.8/[everything_net4.8]+output/net8.0-windows/[everything_net8.0].

Known issues:

  • On net8.0-windows, some waterbox cores (just bsnes?) hardcrash on the first frameadvance. No amount of debug compilation has helped so far, but compiling the waterboxhost with dirty detection disabled fixes this. I'm afraid this may be MAME rom loading regression #3615 all over again.

<PropertyGroup>
<UseWindowsForms>true</UseWindowsForms>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
</PropertyGroup>
Copy link
Member

Choose a reason for hiding this comment

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

This will break compilation on Linux, you'll need to do it conditionally

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've specifically set EnableWindowsTargeting to fix compilation on linux. What compilation problems are you seeing? It compiles fine for me.

Copy link
Member

Choose a reason for hiding this comment

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

I haven't tried. I recall from last time I messed with hammer-and-duct-tape that <UseWindowsForms/> didn't work w/ the net48 TFM, and multi-targeting net6.0-windows prevented building on Linux—<EnableWindowsTargeting/> has obviously been added to fix that, but does it also fix the WinForms references?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Well the net4.8 variant runs fine for me in WSL, so I assume everything is good on that front.
From the tests I've done it seemed that the System.Windows.Forms reference is functionally equivalent to setting UseWindowsForms.

Copy link
Member

Choose a reason for hiding this comment

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

From the docs:

When building on a non-Windows platform, the output may not be the same as when building on Windows. In particular, the executable is not marked as a Windows application (which means that it will always launch a console window) and won't have an icon embedded.

CI is Linux so this is a problem.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

From my testing, the .net48 executable looks correct, so this is presumably only an issue for the .NET(6+) version. I suppose the solution would be to build on windows then?

@CasualPokePlayer

This comment was marked as resolved.

@CasualPokePlayer

This comment was marked as resolved.

@YoshiRulz

This comment was marked as resolved.

@YoshiRulz YoshiRulz changed the title Multi-target .NET Framework 4.8 and .NET 6 Multi-target .NET Framework 4.8 and .NET 8 Feb 14, 2024
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>netstandard2.0;net8.0</TargetFrameworks>
Copy link
Member

@YoshiRulz YoshiRulz Feb 14, 2024

Choose a reason for hiding this comment

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

Just mentioning that this in only necessary because we have BCL backports which get included in the netstandard2.0 assemblies and are invoked as extensions from EmuHawk. All the other libs can target netstandard2.0 only and the build succeeds.

Copy link
Member

Choose a reason for hiding this comment

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

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.

3 participants