I created a window service and a setup installer as described in the article How to create a setup project for a Windows Service application in Visual C# but I was using with Visual Studio 2015. And when I tried to install the service, I got following error:
This setup requires the .NET Framework version 4.6. Please install the .NET Framework and run this setup again. The .NET Framework can be obtained from the Web. Would you like to do this now?
I set the same .NET Framework version 4.6.1 to all the places I know:
I checked whether I have the same version installed on the machine:
The value of the Release DWORD is described here: https://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx
Anyway, I re-installed (uninstall, restart, install, restart) the .NET Framework version 4.6.1 with the offline installer: https://www.microsoft.com/en-us/download/details.aspx?id=49982
But I still have the same problem.
Also I tried to set Any version in Launch condition properties but I got another error during installation:
The only workaround for now is to set the version in Launch condition properties to .NET Framework 4, but then I have a warning during building installer:
WARNING: The target version of the .NET Framework in the project does not match the .NET Framework launch condition version '.NET Framework 4'. Update the version of the .NET Framework launch condition to match the target version of the.NET Framework in the Advanced Compile Options Dialog Box (VB) or the Application Page (C#, F#).
I think this workaround will not install the proper the .NET Framework defined in the prerequires.
Any idea how can I solve this problem?