Change target framework to full profile (console/wpf/silverlight/setup project)
November 23, 2010 1 Comment
In Visual Studio 2010 a C# 4.0 application (whether it’s a Silverlight project, WPF app or console app) will be assigned a default target framework called ‘.NET Framework 4.0 Client Profile’. This is a ‘lightweight’ version of the framework, with as a most notable change that the System.Web has been removed. When you need this namespace in your project, you’ll need to change the target framework to ‘.NET Framework 4.0’.
Changing the target framework for a WPF/Silverlight/Console application to .NET Framework 4.0
Right-click on the project you want to change and choose properties.
In the properties dialog, change the target framework to ‘.NET Framework 4.0’.
You will get a warning. Click ‘Yes’.
Once you’ve done this, you might want to create a setup project for your application. In case you want this, you’d have to keep in mind that the setup project will be created with the .NET Framework 4.0 Client Profile assigned as the default target framework.If you simply add a setup project and hit build you’ll get the following error: “WARNING: The version of the .NET Framework launch condition ‘.NET Framework 4’ does not match the selected .NET Framework bootstrapper package. Update the .NET Framework launch condition to match the version of the .NET Framework selected in the Prerequisites Dialog Box.”
Changing the target framework for yout setup project to ‘.NET Framework 4.0’ requires:
- Changing the launch conditions
- Changing the prerequisites
Changing the launch conditions
The launch conditions can be changed by right clicking the setup project. Select View and then Launch conditions.
Now select ‘.NET Framework’.
You will notice that the properties tab (see right-bottom in the default VS2010 layout) has changed. Change the Version dropdown to ‘.NET Framework 4.0’.
Changing the prerequisites
The prerequisites can be changed through the properties of the installer project.
Click the Prerequisites button.
In the prerequisites dialog, deselect ‘Microsoft .NET Framework 4 Client Profile’ and select ‘Microsoft .NET Framework 4’. Click ‘OK’.
That’s it. Now your solution will build without errors.