locked
Trying to change Targeted framework in VS2010 RRS feed

  • Question

  • Loaded a project containing a mixed-mode DLL which was targeting .NET 2.0 using VS2008.  Having since loaded VS2010, the ability to target .NET 2.0 does not seem to be available.

    I would think that I can still target that version, but most, if not all the assemblies are 4.0  I am only using System namespace and System.Windows.Forms namespace.

     

    Is there a way to change the targeted framework without re-creating the project?

     

    Thanks in advance

     

    Apologies if this is in the wrong forum.  I didn't see one that was applicable

    • Edited by alleyes Tuesday, April 27, 2010 9:22 PM clarify
    Tuesday, April 27, 2010 9:17 PM

Answers

  • Changing the Target .NET Framework for C++/CLI (VS 2010) Edit

    To change the version of the .NET Framework for C++/CLI projects (VS 2010)

    1. Right click on project in Solution Explorer and click Unload project
    2. Right click on unloaded project in Solution Explorer and select Edit <projectname>.vcxproj
    3. In project XML file locate node <PropertyGroup Label="Globals">
    4. In that node locate node <TargetFrameworkVersion> (if the node cannot be found, add it)
    5. Inner text of the node defines target framework. It can be v2.0,v3.0, v3.5 or v4.0
    6. Save vcxproj file and close it
    7. Right click on unloaded project in Solution Explorer and click Reload Project
    Example
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>

    Note:
    These steps apply only for Visual Studio 2010 as it uses new format of C++ project files.
    • Marked as answer by alleyes Wednesday, April 28, 2010 11:34 AM
    Tuesday, April 27, 2010 9:55 PM

All replies

  • Changing the Target .NET Framework for C++/CLI (VS 2010) Edit

    To change the version of the .NET Framework for C++/CLI projects (VS 2010)

    1. Right click on project in Solution Explorer and click Unload project
    2. Right click on unloaded project in Solution Explorer and select Edit <projectname>.vcxproj
    3. In project XML file locate node <PropertyGroup Label="Globals">
    4. In that node locate node <TargetFrameworkVersion> (if the node cannot be found, add it)
    5. Inner text of the node defines target framework. It can be v2.0,v3.0, v3.5 or v4.0
    6. Save vcxproj file and close it
    7. Right click on unloaded project in Solution Explorer and click Reload Project
    Example
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>

    Note:
    These steps apply only for Visual Studio 2010 as it uses new format of C++ project files.
    • Marked as answer by alleyes Wednesday, April 28, 2010 11:34 AM
    Tuesday, April 27, 2010 9:55 PM
  • It's a one time or occasional change so I guess it's not that big of a deal to Unload-Edit-Re-load the project.  Strange though why it's only on the C++/CLI projects.

    Just one more hit on C++/CLI support.

     

    Thanks Brian

    Wednesday, April 28, 2010 11:40 AM
  • Wow this is a really convoluted way to change the target framework.
    • Proposed as answer by NTH78 Thursday, October 11, 2012 8:52 PM
    Friday, July 23, 2010 1:17 AM
  • Here is how you change the Target Framework in VS2010.

    1) Right click the Project.

    2) Click the "Compile" tab

    3) At the bottom click "Advanced Complie Options..."

    4) Choose the framework from "Target framework (all configurations):"

     

    • Proposed as answer by riversda Friday, November 4, 2011 4:02 PM
    Friday, November 4, 2011 4:02 PM