nuspec approach to single package for both 4.0 and 4.5 projects

Topics: General
Jan 24, 2013 at 6:13 PM

i'm looking to author my nuspec so that i can maintain a single package that continues to support 4.0 project usage and adds support for 4.5 project usage.

Are the following contents, lib, dependencies and framework assemblies settings expected to enable that and work providing i'm building package, and users are installing it, using nuget 2.2 and newer?



  <group targetFramework="net40">
    <dependency id="<some net40 package>" version="" />
  <group targetFramework="net45">
    <dependency id="<some net45 package>" version="1.2.6" />

  <frameworkAssembly assemblyName="<some net40 assembly>" targetFramework="net40" />
  <frameworkAssembly assemblyName="<some net45 assembly>" targetFramework="net45" />

Jan 24, 2013 at 6:25 PM

Your package structure looks good. It should work as you expect.

Jan 26, 2013 at 8:14 PM

Thanks for response. 

It seems that my internal company deployment of nuget gallery doesn't currently have the latest nuget.core in place and so attempts to publish packages to it that are using the new nuget 2.0+ dependencies/group settings support generates "Failed to read the package file" error message. 

Is it just the dependencies/group settings above that require nuget gallery deployment to be running the latest nuget.core bits or do the multi-target Content, Lib and frameworkAssemblies/frameworkAssembly[@targetFramework] settings also require it? 

In other words were those specific behaviors supported in nuget gallery installs using pre-nuget 2.0+ nuget.core installations?

Jan 27, 2013 at 4:58 PM

Only the multi-target Content and Tools also requires NuGet 2.1+

The multi-target Lib and frameworkAssemblies had been available before 2.0

Jan 27, 2013 at 10:07 PM

When you said Tools did you mean dependencies?  

If not does the multi-target dependencies support require NuGet 2.1+ and does this mean the Tools folder install/init/uninstall.ps1 scripts support multi-target folder settings as well?

Jan 28, 2013 at 1:57 AM

By TOols, I mean the install/init/uninstall.ps1 scripts.