I have the task of expanding an existing WinForm application to check if the .NET Framework (fx. 3.5) is installed or not.
This does not make sense because it will not work if the required component is missing.
As already mentioned, usually the installer is responsible for the task, checking for the presence of components, interrupting installation, downloading, and installation.
But in any case, nothing prevents you from making a bootloader that will work in most cases (aka requires fewer / no components) and which will launch your .net application. It can be organized in several ways: exe + exe (often renamed), exe + dll, exe + built-in resource (extract and run), etc.
If you are thinking of using MS Visual C ++ to create a bootstrap, this is bad news for you: you need to install the component (yes, this is stupid, but it requires Microsoft Visual C ++ 200x redistributable). Thus, it will again be work for the installer, or you will need to learn to write C / C ++ pure WinAPI software, which is sick but doable.
For example, this is a check on .Net Framework 4.0
// check if net framework 4.0 or higher is installed HKEY hkey; if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Net Framework Setup\\NDP\\v4", 0, KEY_READ, &hkey) != ERROR_SUCCESS) ; // some error RegCloseKey(hkey);
Doesn't look complicated? Then go ahead!