I followed Microsoft documentation and created working WinRT IBackgroundTask that runs on dotnet8. Now I want to integrate it with my app which is deployed as self-contained and it doesn't require framework deployment for dotnet 8. I tried to modify WinRT.Host.runtimeconfig.json from this
{
"runtimeOptions": {
"tfm": "net8.0",
"rollForward": "LatestMinor",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "8.0.0"
}
}
}
to this
{
"runtimeOptions": {
"tfm": "net8.0",
"includedFrameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "8.0.3"
}
],
}
}
but it doesn't work. Any suggestions?
I see this in event viewer
Application: backgroundTaskHost.exe
CoreCLR Version: 8.0.324.11423
.NET Version: 8.0.3
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Runtime.InteropServices.COMException (0x80080204)
at MobiSystems.BackgroundTasks.CheckForUpdates.CheckForUpdatesBackgroundTask.RunExecutionAlias()
at MobiSystems.BackgroundTasks.CheckForUpdates.CheckForUpdatesBackgroundTask.Run(IBackgroundTaskInstance taskInstance)
at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
It is not supported see here: https://github.com/microsoft/CsWinRT/issues/1141
Microsoft doesn't provide framework package for .net core and tell us to use self-contained deployments for packaged apps but also don't support features in self-contained app. Priceless.