Tuesday, October 16, 2012

Enable the full .NET Framework in Console Application

Console Projects created by Visual Studio 2010 support only a limited subset of the .NET Framework (read more about this on MSDN). This means that for such projects some libraries will be filtered away by VS2010 from the Add a Reference dialog.
To gain access to all .NET libraries available on your PC, you may want to tweak the element called TargetFrameworkProfile in the project file (=<your-project-name>.csproj). Follow the steps below:
  1. Open that file in a code editor of your choice (for example, in Notepad++),
  2. Find the TargetFrameworkProfile element. Notice that it is set to Client like below:
    <TargetFrameworkProfile>Client</TargetFrameworkProfile>.
  3. Change it to <TargetFrameworkProfile  />.
  4. Then restart the project and enjoy the full version of the .NET Framework!
Note: As of .NET 4.5, the TargetFrameworkProfile property is discontinued (for more details see here).

No comments: