Export (0) Print
Expand All

How to: Target a Version of the .NET Framework

This document describes how to target a version of the .NET Framework when you create a project and how to change the targeted version in an existing Visual Basic, Visual C#, or Visual F# project.

Important note Important

For information about how to change the target version for C++ projects, see How to: Modify the Target Framework and Platform Toolset.

In this topic

When you create a project, the version of the .NET Framework that you target determines which templates you can use.

Note Note

In Express editions of Visual Studio, you must create the project first, and then you can change the target, as Changing the Targeted Version describes later in this topic.

To target a version when you create a project

  1. On the menu bar, choose File, New, Project.

  2. In the list at the top of the New Project dialog box, choose the version of the .NET Framework that you want your project to target.

    Note Note

    Typically, only one version of the .NET Framework is installed with Visual Studio. If you want to target another version, you must first make sure that it's installed. See Visual Studio Multi-Targeting Overview.

  3. In the list of installed templates, choose the type of project that you want to create, name the project, and then choose the OK button.

    The list of templates shows only those projects that are supported by the version of the .NET Framework that you chose.

You can change the targeted version of the .NET Framework in a Visual Basic, Visual C#, or Visual F# project by following this procedure.

To change the targeted version

  1. In Solution Explorer, open the shortcut menu for the project that you want to change, and then choose Properties.

    Visual Studio Solution Explorer Properties
    Important note Important

    For information about how to change the target version for C++ projects, see How to: Modify the Target Framework and Platform Toolset.

  2. In the left column of the properties window, choose the Application tab.

    Visual Studio App Properties Application tab
    Note Note

    After you create a Windows Store app in Visual Studio 2013, you can't change the targeted version of either Windows or the .NET Framework.

  3. In the Target Framework list, choose the version that you want.

  4. In the verification dialog box that appears, choose the Yes button.

    The project unloads. When it reloads, it targets the .NET Framework version that you just chose.

    Note Note

    If your code contains references to a different version of the .NET Framework than the one that you targeted, error messages may appear when you compile or run the code. To resolve these errors, you must modify the references. See Troubleshooting .NET Framework Targeting Errors.

Show:
© 2014 Microsoft