❔ Output error when user missing .NET runtime
I have an AvaloniaUI project targetting .NET Framework 4.6.2 AND .NET6. It builds two EXEs: one for NET6 and one for NET462. Works great, except there's an annoyance I'd like to fix:
When the user opens my program and they're missing the required NET runtime for that specific EXE, my program will crash to desktop. No errors, warnings, popups, nothing. Happens before any of my stuff is initialized so I can't even log to a file.
I realize this is a user issue but I'd like to at least be able to tell my user the problem.
Does anyone by chance know a solution?
9 Replies
Entry point:
you want to still run your .NET application without .NET to tell them they need to install .NET?
Would it be an option to distribute your binary in a self-contained way together with the framework?
I'd also agree with Jimmacle here, not sure if I see this working without .Net
self contained or an installer that detects and installs .NET if needed seem like good ideas
I just want some sort of diagnostic to inform the user the problem rather than crashing with no info. Currently the #1 question being asked on my issues board lol. I figure there might be some sort of early event that doesn't need a NET runtime?
I don't think that's feasable as I target both linux and windows. If a user downloads the net462 version it definitely ain't going to run on linux.
regardless of if i pack it
I considered including a bat script that'd open my program and call
dotnet --listsdks
, until I found out that the end user NET version doesn't include the sdk.. so I'm stumped.well, you could use
--list-runtimes
but, also, there is definitely an error that gets printed/shown by .NET when it isn't installed
you should not need to do this yourslf
but, also, i don't understand why you are building for net462because I need to support early windows operating systems. My program is written for a very old game that runs on windows xp. Realistically I can't target XP but targetting net462 at least lets me target vista
--list-runtimes isn't really available to users with the runtime and not the sdk
I think you're looking for a setup.exe / MSI installer. There's a bunch of ways to build those alongside your project. As for crossplatform compatibility, there's a reason sites have multiple download links 1 for each OS. They all need the correct runtimes and dependencies to be installed. You'd need to create a separate setup project to create all of these if that's something you want to support.
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.