.NET 8 Windows Service Fails to Start Due to .NETCore.App Version Mismatch
JY_2013 describes a .NET 8 application failing to start as a Windows service due to a missing Microsoft.NETCore.App version, despite WindowsDesktop.App being present. The post explores runtime dependencies and versioning.
.NET 8 Windows Service Fails to Start Due to .NETCore.App Version Mismatch
Issue Summary
A .NET 8 Windows service fails to start, logging the following error in the Windows Event Viewer:
You must install or update .NET to run this application. … Framework: ‘Microsoft.NETCore.App’, version ‘8.0.21’ (x64) … The following frameworks were found: 8.0.20 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Environment and Details
- Application Target: .NET 8.0 (runtimeconfig.json specifies 
net8.0with dependencies on Microsoft.NETCore.App and Microsoft.WindowsDesktop.App) - System Runtimes Installed:
    
- Microsoft.AspNetCore.App 8.0.21
 - Microsoft.NETCore.App 8.0.20
 - Microsoft.WindowsDesktop.App 8.0.20
 
 - Observed Problem:
    
- The application demands Microsoft.NETCore.App 8.0.21 but only 8.0.20 is available, resulting in failure to start.
 - User expected WindowsDesktop.App 8.0.20 to include sufficient runtime support.
 
 
Why This Happens
- .NET Runtime Structure:
    
Microsoft.WindowsDesktop.Appdepends onMicrosoft.NETCore.App(i.e., Desktop runtime is an extension but does not supersede or satisfy Core runtime).- The version of Microsoft.NETCore.App required by your app (8.0.21) was not satisfied by the 8.0.20 on your system.
 - Even if WindowsDesktop.App runtime is present, the corresponding Core runtime version must be installed for proper execution.
 - Desktop runtime versions and Core runtime versions are released in parallel but not bundled together for upgrades.
 
 - Version Matching:
    
- If your app was built with or requires .NETCore.App 8.0.21, having only 8.0.20 installed will not satisfy the requirement. .NET follows strict runtime version resolution (especially for patch/security versions above minor releases).
 - WindowsDesktop.App 8.0.20 contains only its own managed DLLs and dependencies. You still need Microsoft.NETCore.App 8.0.21 present specifically.
 
 - Learn More:
 
How to Fix
- Install Microsoft.NETCore.App 8.0.21:
    
- Download from: Official .NET Download Page
 - Running 
dotnet --list-runtimesafter installation should show Microsoft.NETCore.App 8.0.21 is present. 
 - General Recommendations:
    
- Ensure all required runtimes listed in your app’s runtimeconfig.json are present at the required version.
 - Consider self-contained deployment if targeting environments with unknown runtime versions.
 
 - Additional Troubleshooting:
    
- If issues persist, verify the application’s published artifacts and confirm the runtimeconfig.json matches your expected target frameworks and versions.
 
 
Key Takeaways
- Microsoft.WindowsDesktop.App requires a matching Microsoft.NETCore.App.
 - Application will not start with only the Desktop runtime present if the specific Core version is absent.
 - Always install the exact or higher patch version of each required runtime listed in runtimeconfig.json.
 
This post appeared first on “Microsoft Tech Community”. Read the entire article here