Target Version of the .NET Framework does not match Launch Condition
It turns out that the C++ code was also associated with .NET for some reason. I used this article to help me change the c++ .NET version from 4.0 to 3.5. The basic steps are
- Open the c++ project vcxproj in a text editor
- Find
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- This may need to be created under the Globals PropertyGroup
- Change 4.0 to 3.5
- Open the project in VS
- Right click the c++ project and select properties
- Select Common Properties and confirm that the version is 3.5
- Select Configuration Properties -> General
- Make sure the Platform Toolset is set to v90
Had same problem as this project had been converted from 2008 to 2010.
To change the bootstrapper, I opened the .csproj and manually removed instances from 3.5 in it:
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
Also, I found out you can just right click on the Setup and Deployment project, hit properties, go to prerequisites, and select the correct .NET framework.
It was hard to find it, you have to click on the Prerequisites button.
To alter it through the UI (not a text editor). Taken from here.
1) Select installer project
2) In Solution Explorer or Solution Navigator click on the icon at the top of the panel "Launch Conditions Editor" (In VS2010 its the icon with binoculars, in VS2015 and VS2017 the icon is a sheet of paper with a filter in front of it (shout out to Mat and Bob Van de Vijver in the comments).
3) Under Launch Conditions, Select ".Net framework" on the right in "Properties" Select "Version" you will see a drop down. change the framework to your target framework.
4) Build and install.
If you then receive a message similar to the following:
WARNING: The version of the .NET Framework launch condition '.NET Framework 4' does not match the selected .NET Framework bootstrapper package. Update the .NET Framework launch condition to match the version of the .NET Framework selected in the Prerequisites Dialog Box.
Perform the following steps:
1) Right click the installer project and click 'properties'.
2) Click on the 'Prerequisites' button.
3) Change as desired.
EDIT: Updated the Launch Conditions Editor icon description for different version of VS, as per the comments.