I recently upgraded my WPF app from .NET framework 4.7 to .NET 6. But when I try to deploy my app on my client's computer, my app won't start because this new computer don't have .NET Desktop Runtime installed. So, how do I detect the absence of .NET runtime and promt a window asking the app user to download .NET runtime? Just like the below picture:
I'm not using any installer, just copy and paste my build folder to the new machine.
I remember that when I was using .NET framework, if the runtime was missing, the Windows system would automatically promt a window ask me to download the runtime.
CodePudding user response:
Obviously your .NET 6 app won't be able to start and even less detect something unless the .NET 6 runtime is installed on the machine where you run the app.
To overcome this issue, you could bundle the .NET 6 runtime with your app by publishing it as self-contained:
dotnet publish -r win-x86
You will then copy the entire output of the publish folder, which includes the necessary .NET assemmblies, to the target machine.
Please refer to the linked docs for more information.