Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Warn user of .NET Framework requirements

So I have an app (tool) that uses .NET 3.0. When run on a machine that only has .NET 2.0 (like the default Server 2008 R2 install) it crashes miserably.

What I've seen so far is that people are using a shunt that will first check the .NET version. Is there a way to build it or add some manifest somehow so that the user is warned of this problem (and hopefully be prompted to install .NET)?

I know this can be solved by an installer, but I have requirements that need it to be a standalone executable. (Ok this is hard to explain, but it's related to the a device driver. The tool comes with the driver, but the user shouldn't be forced to install .NET 3.0 if they won't use the tool.)

I just need to stop at the point where a cryptic "application has failed with exception 0xe0434f4d" message and at the very least give the user some idea of what happened.

like image 758
moogs Avatar asked Feb 27 '23 07:02

moogs


2 Answers

Have not tested this, but this article about framework detection tells how you could detect the framework version from code. I'm not sure where your application fails and if injecting checks like this could solve your problem, but if you cannot use this in your app, you could perhaps create a small "starter app" in old .net 2.0 that performs these checks and then either tells the user to upgrade or starts your "real" app?

As I said, haven't tested this approach, it's just off the top of my mind.

like image 156
wasatz Avatar answered Mar 07 '23 21:03

wasatz


This never makes any sense to me. Where are you going to stop? Are you going to make sure as well that the user doesn't install it on Windows 98? That the machine has enough RAM? That the user account has enough privileges?

Software vendors publish system requirements. You always quote the lowest supported Windows version, minimum amount of RAM, required disk space, minimum browser version, etc. Minimum .NET framework version belongs in that list too. The intention of this list is clear: don't expect it to work properly if you don't meet the requirements. If you do it anyway, it is your problem, not mine.

This is different for a consumer-level app. But when you install to Windows 2008 server, you are not writing a consumer app.

like image 26
Hans Passant Avatar answered Mar 07 '23 20:03

Hans Passant