39

I have a C# project that I previously had targeting .NET 4.0, and now I want to target .NET 3.5, but I am getting this warning:

The version of the .NET Framework launch condition '.NET Framework 3.5' 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.

But when I look under Publish->Prerequisites, .NET framework 3.5 SP1 is checked.

What do I need to do to get rid of this warning? There is no checkbox for .NET framework 3.5 without SP1, can I just not check any box?

I checked the launch condition, and the .NET framework launch condition version is already 3.5.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Drew
  • 12,578
  • 11
  • 58
  • 98

3 Answers3

64

I found that I needed to right click on my Setup and Deployment project, hit properties, go to prerequisites, and uncheck .NET framework 4 and check .NET framework 3.5.

I had done that for all of the projects but for the setup and deployment project. I didn't realize it had its own prerequisites section.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Drew
  • 12,578
  • 11
  • 58
  • 98
  • Making this relevant for Visual Studio 2017/C# WPF, right click Project -> Properties, click "Publish" tab in left margin, click Prerequisites... button. Uncheck and check desired .NET Framework targets, indicate where the framework dependency is installed from. – BoiseBaked Nov 07 '18 at 15:27
  • Of course, this assumes a second step was taken to re-target the application itself to the same .NET Framework. I.e. right click Project to Properties, Applications tab in left margin, Target framework: drop box, select corresponding .NET Framework version. – BoiseBaked Nov 07 '18 at 15:53
  • Where is this button in Visual Studio 2019? I am trying to remove references to .NET Framework 3.5. – Aaron Franke Mar 28 '22 at 21:43
11

It's likely coming from the installer project that you have within the solution. I'm guessing you do have one, as it's the only place I've seen Visual Studio talk about launch conditions.

Select it in Solution Explorer, and then at the top click the little icon with binoculars (Launch Condition Editor).

Under Launch Conditions, right click on the .NET Framework and open the properties, and then change the Version to .NET Framework 3.5.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
dotalchemy
  • 2,459
  • 19
  • 24
  • 2
    The version is already .NET framework 3.5 and it hasn't fixed the warning. – Drew Mar 21 '11 at 21:18
  • I had this problem for .NET framework 4.0 and every thing seems correct so i went in under Properties -> Prerequisites and removed .net 4.0 then pressed OK, then went in there again and added it back again. that resolved my warning.. – Peter Apr 09 '14 at 14:36
5

I just got that error and i fixed it easily by double clicking the error message.

A window shows up. Then you can modify the properties of the different elements on the page by right clicking them -->> properties.

Just make sure all the items on this page have the desired framework version.

PS: on VS2010

dyesdyes
  • 1,147
  • 3
  • 24
  • 39