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

Add WinRT.StubExe project and .targets to support WinRT activation for apps #1640

Closed
wants to merge 14 commits into from

Conversation

Sergio0694
Copy link
Member

Depends on: dotnet/runtime#103504

This PR includes two changes:

  • Adds a new WinRT.StubExe project to produce a native .exe that will invoke a custom Main from applications, which will leverage the new CustomNativeMain functionality from .NET 9 (see related PR there). This enables apps to both be executed normally, as well as act as implementation .dll for WinRT components (eg. for OOP background tasks).
  • Some .targets changes to wire things up when publishing (configuring NativeAOT props, bundling the stub .exe, etc.)

Note

Opening as a draft as things are still very much up in the air at this point.

@Sergio0694 Sergio0694 added enhancement New feature or request AOT labels Jun 15, 2024
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
Copy link
Member

Choose a reason for hiding this comment

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

I think you will need to enable a more options here to pass https://github.com/microsoft/binskim

@Sergio0694 Sergio0694 force-pushed the user/sergiopedri/stub-exe branch from e3cc8f3 to 1391296 Compare June 16, 2024 02:16
@Sergio0694
Copy link
Member Author

Spoke at length with @MichalStrehovsky, @jkoritzinsky and @AaronRobinsonMSFT, and I think the conclusion is that the simplest/best way to do this is to port over some code from DNNE and have a custom MSBuild task just invoke cl.exe to build/link a C program just forwarding to the custom main. This will keep things simple enough (and all the code we need is already there in DNNE), will let us have a stub .exe directly linking to the custom main, without the need for LoadLibrary at runtime or anything else, and it will also allow us to customize the .exe when needed in a single step, by just passing additional arguments to the linker (eg. /APPCONTAINER). Going to close this one 🙂

@Sergio0694 Sergio0694 closed this Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AOT enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants