Export (0) Print
Expand All

How to: Target a Specific .NET Framework

Updated: July 2008

The following procedures describe how to create a project that targets a specific .NET Framework version and how to change the target .NET Framework version for an existing project.

This procedure describes how to create a new project that targets a specific .NET Framework version.

To create a new project that has a specific .NET Framework target

  1. In Visual Studio 2008, on the File menu, point to New and then click Project.

    Doing this displays the New Project dialog box.

  2. Select a project type, such as Visual C# Windows Application.

  3. In the upper-right corner of the New Project dialog box, click the combo box and select the .NET Framework version you want your project to target, for example, .NET Framework 3.5.

  4. Click OK and then continue to create your project as usual.

NoteNote:

The project templates that are available depends on the .NET Framework version you choose.

This procedure describes how to change the .NET Framework version target of an existing project.

To change the .NET Framework version of a project

  1. In Visual Studio 2008, open the project you want to change.

  2. Right-click the project in Solution Explorer and then click Properties.

    Doing this displays the Project Designer.

  3. Go to the Target Framework drop-down list.

    For Visual Basic projects, click the Compile tab and then click Advanced Compile Options. The Target Framework list is in the Advanced Compiler Settings Dialog Box (Visual Basic).

    For Visual C# projects, the Target Framework list is on the Application tab of the Project Designer. For more information, see Application Page, Project Designer (C#).

  4. In the Target Framework list, click a .NET Framework version that differs from the current one for the project.

    The project now targets the new .NET Framework version. The project will unload and then reload in the integrated development environment (IDE). 

    NoteNote:

    If you change the .NET Framework target version, you may receive error messages if your code contains references to a different version. To resolve these errors, you must manually modify the references.

This procedure describes how to specifically target and require .NET Framework 3.5 SP1 for ClickOnce deployment only. 

After Visual Studio 2008 SP1, or .NET Framework 3.5 SP1, is installed, existing applications that only require .NET Framework 3.5 will still target .NET Framework 3.5. For applications that you want to specifically require .NET Framework 3.5 SP1, you must either incorporate one of the new ClickOnce features in Visual Studio 2008 SP1, which are listed in the following procedure, or add a reference to the new System.Data.Entity.dll assembly.

To specifically target.NET Framework 3.5 SP1

  1. In Visual Studio 2008, open the project that you want to target .NET Framework 3.5 SP1.

  2. Perform one of the following actions that enable an SP1 ClickOnce feature:

    • Specify an Error URL in the Publish Options dialog box.

    • Specify a Suite name in the Publish Options dialog box.

    • Create a desktop shortcut in the Publish Options dialog box.

    • Exclude a file from the hash in the Application Files dialog box.

    • Clear the Sign the ClickOnce manifests check box on the Signing page.

    -or-

    • Add a reference to the System.Data.Entity assembly.

    NoteNote:

    If you change the .NET Framework target, you may receive error messages if your code contains references to a different version. To resolve these errors, you must manually modify the references.

This procedure describes how to specifically target the .NET Framework Client Profile. The .NET Framework Client Profile provides a redistribution package that installs a subset of the .NET Framework on a target computer so that the full .NET Framework is not required to be present. For more information about the .NET Framework Client Profile, see .NET Framework Client Profile.

To specifically target.NET Framework Client Profile in Visual Basic

  1. In Visual Studio 2008, open the project you want to change.

  2. Right-click the project in Solution Explorer and then click Properties.

    Doing this displays the Project Designer.

  3. Click the Compile page.

  4. Click Advanced Compile Options.

  5. Select Client-only Framework subset.

To specifically target.NET Framework Client Profile in C#

  1. In Visual Studio 2008, open the project you want to change.

  2. Right-click the project in Solution Explorer and then click Properties.

    Doing this displays the Project Designer.

  3. Click the Application page.

  4. Select Client-only Framework subset.

Date

History

Reason

July 2008

Added a section about how to target .NET Framework 3.5 SP1 and the .NET Framework Client Profile.

SP1 feature change.

September 2008

Added clarification for ClickOnce deployment.

Customer feedback.

Community Additions

ADD
Show:
© 2014 Microsoft