|
1 | 1 | # Advanced Migration Topics |
2 | 2 |
|
3 | | -// 1. WebPort |
4 | | -// specifying the WebPort in the manifest is no longer supported |
5 | | -// from commit message: |
6 | | -//- Removed the 'electronWebPort' handling |
7 | | -// When ASP.Net is launched first, then the information which port it |
8 | | -// should use would be coming too late; anyway, there's no need for |
9 | | -// letting the port number round-trip all the way through the manifest |
10 | | -// file, loaded by main.js and then sent to dotnet. |
11 | | -// |
| 3 | +This guide covers advanced scenarios and edge cases that may require additional configuration when migrating to ElectronNET.Core. |
12 | 4 |
|
13 | | -if the asp web port needs to be specified manually, this can be by setting it via MSBuild like this: |
| 5 | +## Custom ASP.NET Port Configuration |
14 | 6 |
|
15 | | - <ItemGroup> |
16 | | - <AssemblyMetadata Include="AspNetHttpPort" Value="4000" /> |
17 | | - </ItemGroup> |
| 7 | +### Port Configuration Changes |
18 | 8 |
|
| 9 | +**Previous Approach:** |
| 10 | +Specifying the WebPort in `electron.manifest.json` is no longer supported because the ASP.NET-first launch mode makes this timing-dependent. |
| 11 | + |
| 12 | +**New Approach:** |
| 13 | +Configure custom ASP.NET ports through MSBuild metadata: |
| 14 | + |
| 15 | +```xml |
| 16 | +<ItemGroup> |
| 17 | + <AssemblyMetadata Include="AspNetHttpPort" Value="4000" /> |
| 18 | + <AssemblyMetadata Include="AspNetHttpsPort" Value="4001" /> |
| 19 | +</ItemGroup> |
| 20 | +``` |
| 21 | + |
| 22 | +**Usage in Code:** |
| 23 | +```csharp |
| 24 | +// Access configured ports at runtime |
| 25 | +var port = int.Parse(Electron.App.GetEnvironmentVariable("AspNetHttpPort") ?? "5000"); |
| 26 | +``` |
19 | 27 |
|
20 | 28 | ## Custom ElectronHostHook Configuration |
21 | 29 |
|
@@ -62,3 +70,44 @@ if the asp web port needs to be specified manually, this can be by setting it vi |
62 | 70 | - **Updated Node.js Types** - Compatibility with Node.js 22.x APIs |
63 | 71 | - **ESLint Integration** - Better code quality and consistency |
64 | 72 | - **MSBuild Compilation** - Integrated with Visual Studio build process |
| 73 | + |
| 74 | +## Troubleshooting Advanced Scenarios |
| 75 | + |
| 76 | +### Multi-Project Solutions |
| 77 | + |
| 78 | +When using ElectronNET.Core in multi-project solutions: |
| 79 | + |
| 80 | +1. **Install ElectronNET.Core.Api** in class library projects |
| 81 | +2. **Install ElectronNET.Core** only in the startup project |
| 82 | +3. **Share configuration** through project references or shared files |
| 83 | + |
| 84 | +### Custom Build Processes |
| 85 | + |
| 86 | +For advanced build customization: |
| 87 | + |
| 88 | +```xml |
| 89 | +<PropertyGroup> |
| 90 | + <ElectronNETCoreOutputPath>custom\output\path</ElectronNETCoreOutputPath> |
| 91 | + <ElectronNETCoreNodeModulesPath>custom\node_modules</ElectronNETCoreNodeModulesPath> |
| 92 | +</PropertyGroup> |
| 93 | +``` |
| 94 | + |
| 95 | +### Environment-Specific Configuration |
| 96 | + |
| 97 | +Handle different environments with conditional configuration: |
| 98 | + |
| 99 | +```xml |
| 100 | +<PropertyGroup Condition="'$(Configuration)' == 'Debug'"> |
| 101 | + <ElectronNETCoreEnvironment>Development</ElectronNETCoreEnvironment> |
| 102 | +</PropertyGroup> |
| 103 | + |
| 104 | +<PropertyGroup Condition="'$(Configuration)' == 'Release'"> |
| 105 | + <ElectronNETCoreEnvironment>Production</ElectronNETCoreEnvironment> |
| 106 | +</PropertyGroup> |
| 107 | +``` |
| 108 | + |
| 109 | +## Next Steps |
| 110 | + |
| 111 | +- **[Migration Guide](Migration-Guide.md)** - Complete migration process |
| 112 | +- **[What's New?](What's-New.md)** - Overview of all ElectronNET.Core features |
| 113 | +- **[Getting Started](../GettingStarted/ASP.Net.md)** - Development workflows |
0 commit comments