views:

2685

answers:

5

1, Create and build a default Windows Forms project and look at the project properties. It says that the project is targetting .NET Framework 2.0.

2, Create a Setup project that installs just the single executable from the Windows Forms project.

3, Run that installer and it always says that it needs to install .NET 3.5 SP1 on the machine. But it obviously only really needs 2.0 and so I do not want customers to be forced to install .NET 3.5 when they do not need it. They might already have 2.0 installed and so forcing the upgrade is not desirable!

I have looked at the prerequisites of the setup project and checked the .NET Framework 2.0 entry and all the rest are unchecked. So I cannot find any reason for this strange runtime requirement. Anybody know how to resolve this one?

+1  A: 

Even if you are targetting a 2.0 deployment, some of your assemblies might require 3.5. For instance, LINQ requires 3.0. This should, however, be reflected when you build. Check each assembly to ensure that it's 2.0 compatible. You don't want any 3.5 things sneaking in. If this is the case, my guess would be a 3rd party control library with support for WPF.

David Sokol
A: 

I eventually found the answer to my own question.

Comparing the projects files using Notepad I noticed that a setup project in VS2008 has an entry that requests version 3.5 and the same section in the VS2005 project was marked as 2.0. What is strange is that the section looks like something you cannot manually alter within the Visual Studio environment and so you are forced to update the project file manually. Anywhere here is the offending area of the project file for those that comes across the same issue...

"Deployable"
{
    "CustomAction"
    {
    }
    "DefaultFeature"
    {
    "Name" = "8:DefaultFeature"
    "Title" = "8:"
    "Description" = "8:"
    }
    "ExternalPersistence"
    {
        "LaunchCondition"
        {
            "{A06ECF26-33A3-4562-8140-9B0E340D4F24}:_FC497D835F7243569DCCC3E3ACE4196D"
            {
            "Name" = "8:.NET Framework"
            "Message" = "8:[VSDNETMSG]"
            "Version" = "8:3.5.30729"  <--- UPDATE THIS TO 8:2.0.50727
            "AllowLaterVersions" = "11:FALSE"
            "InstallUrl" = "8:http://go.microsoft.com/fwlink/?LinkId=76617"
            }
        }
    }
Phil Wright
+17  A: 

No need to edit the file manually. The hint is just above the GUID there:"LaunchCondition".

  1. Right click the setup project
  2. Select "View" -> "Launch Conditions"
  3. Expand the "Launch Conditions" node if it isn't already expanded
  4. Right click the ".NET Framework" node and select "Properties Window"
  5. In the "Properties" window change the "Version" value to the appropriate value, in your case 2.0.50727.

I'm not sure why this isn't set appropriately from the start.

Aydsman
A: 

I've always used Innosetup to deploy my projects. It's very fast, and very customizable. There's almost nothing you can't do with a bit of scripting. Innosetup can detect which version of the Framework is installed, and prompt the user if the correct version is not present (with scripting).

I recommend that you try alternative deployment tools like Innosetup and see if you like them. There's a wealth of an opportunity out there.

Cyril Gupta
A: 

Very Userful