Target nuget packege for multiple framework

When you’re building a .Net liibrary you have to take in care which framework the end user will use. In order to avoid user’s framework upgrade/downgrade we must target multiple frameworks in the nuget package.

Library project configuration

First, in your .csproj file, create separate build configurations. I created “Debug” | “Release” and “Debug45” | “Release45” for the target frameworks 4.6.1 and 4.5 respectively. I manually set the OutputPath and added theTargetFrameworkVersion element to each configuration:

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug45|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release45|AnyCPU'">

In this way you can build the library with different target framework.

Targeting Multiple Frameworks in NuGet

In the folder created for the nuget package divide the lib folder by adding for each targeted framework the relative folder where you will add the relative library .dll file.

The lib folder looks like this:

  • lib
    • net45
    • net461

Now you can run nuget.exe pack MyAssembly.nuspec

A new package is created.

When you refer this package through Nuget package manager from a VS solution, your reference automatically link the dll related to your project framework.


Setting up the MS.NET Enterprise Environment for Application Development

A new machine configuration for Microsoft development software.


  1. Install Visual Studio 2010 from DVD
  2. Install Team Explorer (.iso) from
  3. Install Visual Studio 2010 SP1 from


  1. Install Microsoft SQL Server 2008 R2 RTM – Express with Management Tools from
  2. Install Microsoft® SQL Server® 2008 R2 Service Pack 1 from
  3. Otherwise (1-2) you can download and install these products separately:

Windows Phone

  1. Install Windows Phone SDK (actual SDK 7.1) from
  2. Verify and install Windows Phone Developer Tool Update from


  1. Install the latest version of Silverlight SDK (check Microsoft’s Web Site – actual version 5.0.x)
  2. Install Silverlight Toolkit based on last installed version
  3. Install Silverlight for Windows Phone Toolkit (actual release september 2010) from


  1. Install Microsoft Kinetic SDK (Beta version) from


  1. Install Windows Azure SDK e VSCloudService (actual version 1.4) from
  2. Otherwise (1) you can download and install Windows Azure SDK All-in-one (actual september 2010) from

Microsoft Web Platform

You can complete your installations with the Microsoft Web Platform availabe at

Visit Microsoft’s web site for latest updates