Add DotNet-First packaging layout support and build extensibility - #1106
Open
DYH1319 wants to merge 1 commit into
Open
Add DotNet-First packaging layout support and build extensibility#1106DYH1319 wants to merge 1 commit into
DYH1319 wants to merge 1 commit into
Conversation
pr-comment: Run #137
🎉 All tests passed!Github Test Reporter by CTRF 💚 🔄 This comment has been updated |
- Detect and launch the Electron host from an electron/ subdirectory when using a DotNet-First packaged app layout. - Make ElectronPackageId and Title overridable from MSBuild properties. - Allow overriding the intermediate PublishDir via ElectronPublishDir. - Add ElectronSkipExecCommands to suppress npm/npx build steps. Co-Authored-By: Mark Deng <1245687900@qq.com>
DYH1319
marked this pull request as ready for review
August 24, 2026 10:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR makes the Electron.NET runtime and MSBuild targets support an additional "DotNet-First" packaged app layout and gives packaging builds a few more escape hatches.
Motivation
Today the runtime probes for the packaged layout
resources/bin/<app>(Electron-first). When the .NET publish output is the app root and the Electron host is placed under anelectronsubdirectory (DotNet-First),UnpackagedDetectormis-identifies the app as unpackaged andElectronProcessActivecannot find the Electron binary.In addition,
ElectronPackageId,Title, the intermediatePublishDir, and thenpm/npxexec steps are hard-coded, which makes it harder to plug Electron.NET into custom packaging pipelines or CI.Changes
DotNet-First layout detection in
UnpackagedDetector.CheckUnpackaged2:electronsubdirectory, treat the app as packaged.resources/bin(Electron-first) and.electron(development) checks are preserved.DotNet-First binary startup in
ElectronProcessActive.StartCore:dir/electronexists, startelectronfrom that directory and use it as the working directory.dir.Parent.Parentlogic for the Electron-first layout.Overridable build properties in
ElectronNET.Core.props:ElectronPackageIdandTitleonly default fromMSBuildProjectNamewhen the properties are not already set.Configurable publish/exec targets in
ElectronNET.LateImport.targets:ElectronPublishDircan override the intermediatePublishDir.ElectronSkipExecCommands(defaultfalse) can suppressnpm/npxexecution steps.Exectasks fornpm/npxnow respectElectronSkipExecCommands.Files changed
src/ElectronNET.API/Runtime/Helpers/UnpackagedDetector.cssrc/ElectronNET.API/Runtime/Services/ElectronProcess/ElectronProcessActive.cssrc/ElectronNET/build/ElectronNET.Core.propssrc/ElectronNET/build/ElectronNET.LateImport.targets