Files
Electron.NET/docs/Core/Advanced-Migration-Topics.md

91 lines
2.7 KiB
Markdown
Raw Permalink Normal View History

2025-10-15 12:50:31 +02:00
# Advanced Migration Topics
2025-10-14 09:52:44 +02:00
This guide covers advanced scenarios and edge cases that may require additional configuration when migrating to ElectronNET.Core.
2025-10-15 12:50:31 +02:00
2025-10-14 09:52:44 +02:00
## Custom ASP.NET Port Configuration
2025-10-15 12:50:31 +02:00
2025-10-14 09:52:44 +02:00
### Port Configuration Changes
2025-10-15 12:50:31 +02:00
2025-10-15 16:06:09 +02:00
**Previous Approach:**
2025-10-14 09:52:44 +02:00
Specifying the WebPort in `electron.manifest.json` is no longer supported because the ASP.NET-first launch mode makes this timing-dependent.
2025-10-15 12:50:31 +02:00
2025-10-15 16:06:09 +02:00
**New Approach:**
2025-10-14 09:52:44 +02:00
Configure custom ASP.NET ports through MSBuild metadata:
2025-10-15 12:50:31 +02:00
2025-10-14 09:52:44 +02:00
```xml
<ItemGroup>
<AssemblyMetadata Include="AspNetHttpPort" Value="4000" />
</ItemGroup>
```
2025-10-15 12:50:31 +02:00
2025-10-14 09:52:44 +02:00
## Custom ElectronHostHook Configuration
2025-10-15 12:50:31 +02:00
2025-10-15 16:06:09 +02:00
> [!NOTE]
> These changes are only required in case you are using a custom ElectronHostHook implementation!
> If you have an ElectronHostHook folder in your project but you did not customize that code and aren't using its demo features (Excel and ZIP), you can also just remove that folder from your project.
2025-10-14 09:52:44 +02:00
### TypeScript and Node.js Updates
2025-10-15 12:50:31 +02:00
2025-10-14 09:52:44 +02:00
**Update package.json:**
2025-10-15 16:06:09 +02:00
2025-10-15 22:28:35 +02:00
This shows the relevant changes only: All shown versions are the new required minimum versions.
2025-10-15 16:06:09 +02:00
2025-10-14 09:52:44 +02:00
```json
{
2025-10-15 12:50:31 +02:00
"devDependencies": {
2025-10-14 09:52:44 +02:00
"@types/node": "^22.18",
"typescript": "^5.9.3"
2025-10-15 12:50:31 +02:00
},
2025-10-14 09:52:44 +02:00
"dependencies": {
2025-10-15 12:50:31 +02:00
"socket.io": "^4.8.1",
2025-10-14 09:52:44 +02:00
}
2025-10-15 12:50:31 +02:00
}
2025-10-14 09:52:44 +02:00
```
2025-10-15 12:50:31 +02:00
2025-10-15 16:06:09 +02:00
**Update Project File:**
The below modifications will allow you to use the latest TypeScript compiler in your ASP.Net project.
2025-10-14 09:52:44 +02:00
```xml
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="5.9.3" />
2025-10-15 12:50:31 +02:00
2025-10-14 09:52:44 +02:00
<PropertyGroup>
<TypeScriptModuleKind>commonjs</TypeScriptModuleKind>
<TypeScriptUseNodeJS>true</TypeScriptUseNodeJS>
<TypeScriptTSConfig>ElectronHostHook/tsconfig.json</TypeScriptTSConfig>
</PropertyGroup>
2025-10-15 12:50:31 +02:00
2025-10-14 09:52:44 +02:00
<ItemGroup>
<Compile Remove="publish\**" />
<Content Remove="publish\**" />
<EmbeddedResource Remove="publish\**" />
<None Remove="publish\**" />
<TypeScriptCompile Remove="**\node_modules\**" />
</ItemGroup>
```
2025-10-15 12:50:31 +02:00
2025-10-14 09:52:44 +02:00
### Integration Benefits
2025-10-15 12:50:31 +02:00
2025-10-14 09:52:44 +02:00
- **Modern TypeScript** - Latest language features and better type checking
- **Updated Node.js Types** - Compatibility with Node.js 22.x APIs
- **ESLint Integration** - Better code quality and consistency
- **MSBuild Compilation** - Integrated with Visual Studio build process
2025-10-15 12:50:31 +02:00
2025-10-14 09:52:44 +02:00
## Troubleshooting Advanced Scenarios
2025-10-15 12:50:31 +02:00
2025-10-14 09:52:44 +02:00
### Multi-Project Solutions
2025-10-15 12:50:31 +02:00
2025-10-14 09:52:44 +02:00
When using ElectronNET.Core in multi-project solutions:
2025-10-15 12:50:31 +02:00
2025-10-14 09:52:44 +02:00
1. **Install ElectronNET.Core.Api** in class library projects
2025-10-15 16:06:09 +02:00
2. **Install ElectronNET.Core and ElectronNET.Core.AspNet** only in the startup project
2025-10-14 09:52:44 +02:00
3. **Share configuration** through project references or shared files
## Next Steps
- **[Migration Guide](Migration-Guide.md)** - Complete migration process
- **[What's New?](What's-New.md)** - Overview of all ElectronNET.Core features
- **[Getting Started](../GettingStarted/ASP.Net.md)** - Development workflows