8 out of 13 rated this helpful - Rate this topic

How to: Change the Target .NET Framework

Visual Studio 2008

Updated: July 2008

Applies to

The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office.

Project type

  • Document-level projects

  • Application-level projects

Microsoft Office version

  • Microsoft Office 2003

  • 2007 Microsoft Office system

For more information, see Features Available by Application and Project Type.

For Visual Studio Tools for Office, the default version of the Microsoft .NET Framework is version 3.5. However, you can set Microsoft Office 2003 solutions to use version 2.0, 3.0, or 3.5. Office solutions created for the 2007 Microsoft Office system must be developed for .NET Framework 3.5. 

Starting in Visual Studio 2008 Service Pack 1 (SP1), you can develop 2007 Microsoft Office solutions with .NET Framework version 3.5 or .NET Framework Client Profile. The .NET Framework Client Profile is a subset of the full .NET Framework 3.5 that has a size of 25-30 MB. For more information about the .NET Framework Client Profile, see .NET Framework Client Profile.

You can change the target .NET Framework without creating a new project. Visual Basic projects and C# projects have different procedures for changing the target .NET Framework.

To change the version of the .NET Framework for Visual Basic projects

  1. On the Project menu, click ProjectName Properties.

  2. Click the Compile tab.

  3. Click Advanced Compile Options.

  4. In the Target Framework (all configurations) list, select either .NET Framework 2.0, .NET Framework 3.0, or .NET Framework 3.5.

    Note Note:

    For solutions that target the 2007 Microsoft Office system, you must use .NET Framework 3.5 or later.

  5. If you want to develop for .NET Framework Client Profile, specify this configuration:

    1. In the Target Framework (all configurations) list, select .NET Framework 3.5.

    2. Select Client-only Framework subset.

  6. Click OK.

  7. In the Target Framework Change message that appears, click Yes.

To change the version of the .NET Framework for C# projects

  1. On the Project menu, click ProjectName Properties.

  2. Click the Application tab.

  3. In the Target Framework list, select either .NET Framework 2.0, .NET Framework 3.0, or .NET Framework 3.5.

    Note Note:

    For solutions that target the 2007 Microsoft Office system, you must use .NET Framework 3.5 or later.

  4. If you want to develop for .NET Framework Client Profile, specify this configuration:

    1. In the Target Framework (all configurations) list, select .NET Framework 3.5.

    2. Select Client-only Framework subset.

Date

History

Reason

July 2008

Added information about .NET Framework Client Profile.

SP1 feature change.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
How to: Change the Target .NET Framework

I have tried the above and was able to compile the Shim dll successfully but when registered the Shim did not work properly.

After installing the MSI file that I created, I got runtime error in comm-addins when I tried to load the addin in outlook.

In comm-addins the addin displays the following message:

Not loaded. A runtime error occurred during the loading of the addins.

 

I suspect that while changing the Shim framework something went wrong.

 

Can anyone please advice me how I can correct this issue?

Changing the Target .NET Framework for C++/CLI (VS 2010)
I have more questions.  Before change the target framework.  It is grayed out and the value is 4.0 and under the references window
it has System; System.Data; System.Xml.  All have version 4.0.0.0 and public key token.

But when I changed to v3.5, System; System.Data; System.Xml.  All have version 2.0.0.0. 

Any wrong?
Platform Toolset must also be set correctly for C++/CLI project
If you encounter the error .NET Framework 2.0/3.0/3.5 target the v90 platform toolset. Please make sure that Visual Studio 2008 is installed on the machine after retargeting the project to a .NET version prior to 4.0 in VS2010, you will need to do the following: $0 $0in the IDE, go to Solution Explorer > Right-Click your Project > Properties > Configuration Properties > General: General > Platform Toolset: Change "Platform Toolset " from v90 to v100.
When I followed the instructions above...
I got:

C:\lager\Xpace\trunk\windows\xpace_cli\xpace_cli.vcxproj : error  : The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. ...\abc.vcxproj

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

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.