I have a Windows service built using .NET Framework (version 4.6.2). It was made using the "Windows Service (.NET Framework)" template in Visual Studio 2017. For reference, I followed this guide.
A custom installer will be made to install/update/maintain this Windows service on client machines. Here's an overview of the installer:
- User enters some information into a form/UI.
- Validate user input.
- Place the Windows service project binaries in a user-specified directory.
- Run the command to install the Windows service. It will use the Windows sc utility.
- Create a registry key. Insert values into this registry key.
- Ensure .NET Framework 4.6.2 is installed on the machine. Install it if it is not already installed.
As far as I can tell, when the service is started, .NET Framework 4.6.2 needs to already be installed on the machine for the service to work.
How do I make certain that the client's machine has .NET Framework 4.6.2 installed on it?
Also, will other versions of .NET Framework - for example version 4.8 - already installed on the machine cause issues?
I did some searching online, but haven't found any solutions for my situation. This solution only works if we decide to use the Visual Studio Installer project for our installer. Self-contained deployments apparently only work for projects based on .NET Core, not .NET Framework.