How to safely check a version of the .NET Framework using a version of the .NET Framework that may not exist?

I have an application built with .NET 3.5. If the user starts it without installing .NET 3.5, I want to control what they see, and possibly provide a message that they can understand (with reference to .NET 3.5) compared to the raw traces of the exception stack. But if they don’t actually have .NET 3.5, how can my application control something?

+3
source share
4 answers

Even better, you could use an installation technology such as a Wix or Visual Stuido installation project that checks during installation that all prerequisites for your software exist, such as a specific .NET runtime. If not, he will install them, or at least tell the user where to get them and what to do next.

+2
source

Do you assume that at least SOME version of .NET is installed?

You can write a small bootloader for compatibility with all versions for verification.

Or, if .NET is not installed, find a simple batch program (although this can easily be done in C ++ if you want).

@ECHO OFF
SET FileName=%windir%\Microsoft.NET\Framework\v1.1.4322
IF EXIST %FileName% GOTO Skip
ECHO.You currently do not have the Microsoft® .NET Framework 1.1 installed.
ECHO.This is required by the setup program for MyApplication.
ECHO.
ECHO.The Microsoft® .NET Framework 1.1 will now be installed on you system.
ECHO.After completion setup will continue to install MyApplication on your system.
ECHO.
Pause
SET FileName=
Start /WAIT .\dotnetfx.exe
Start .\Setup.exe
ECHO ON
Exit
Tongue Tiedkip
SET FileName=
Start .\Setup.exe
ECHO ON
Exit

It may also help.

+4
source

, 3.5. , .

+2

.NET EXE, .NET. , , . , Windows 2000 , , Visual Basic 6.0 , Visual Basic 6.0, . EXE . ++, - , Windows API.

+1

Source: https://habr.com/ru/post/1704725/


All Articles