This release was so big, we felt compelled to skip versions 2.3 and 2.4! To date, this is the largest release we've had for NuGet, with over 160 work items in the release.
We would like to thank the following external contributors for their significant contributions to NuGet 2.5:
We also appreciate the following individuals for finding bugs with NuGet 2.5 Beta/RC that were approved and fixed before the final release:
One of the most requested features of all time has been the ability to overwrite content files that already exist on disk when included in a NuGet package. Starting with NuGet 2.5, these conflicts are identified and you will be prompted to overwrite the files, whereas previously these files were always skipped.
'NuGet.exe update' and 'Install-Package' now both have a new option '-FileConflictAction' to set some default for command-line scenarios.
Set a default action when a file from a package already exists in the target project. Set to 'Overwrite' to always overwrite files. Set to 'Ignore' to skip files. If not specified, it will prompt for each conflicting file.
A new conventional folder has been created at the top level of the NuGet package. As a peer to \lib, \content, and \tools, you can now include a '\build' folder in your package. Under this folder, you can place two files with fixed names, {packageid}.targets or {packageid}.props. These two files can be either directly under \build or under framework-specific folders just like the other folders. The rule for picking the best-matched framework folder is exactly the same as in those.
When NuGet installs a package with \build files, it will add an MSBuild <Import> element in the project file pointing to the .targets and .props files. The .props file is added at the top, whereas the .targets file is added to the bottom.
Before 2.5, in .nuspec file, user can only specify the reference files, to be added for all framework. Now with this new feature in 2.5, user can author the <reference/> element for each of the supported platform, for example:
<references>
<group targetFramework="net45">
<reference file="a.dll" />
</group>
<group targetFramework="netcore45">
<reference file="b.dll" />
</group>
<group>
<reference file="c.dll" />
</group>
</references>
Here is the flow for how NuGet adds references to projects based on the .nuspec file:
This new feature will allow package authors to use the References feature to apply subsets of assemblies to different frameworks when they would otherwise need to carry duplicate assemblies in multiple lib folders.
Note: you must presently use NuGet.exe pack to use this feature; NuGet Package Explorer does not yet support it.
Many of you know about the "Update-Package" PowerShell cmdlet to update all of your packages; now there's an easy way to do this through the UI as well.
To try this feature out:
Now nuget.exe pack command processes referenced projects with the following rules:
This allows a referenced project to be treated as a dependency if there is nuspec file, otherwise, it becomes part of the package.
More details here: http://nuget.codeplex.com/workitem/936
A new metadata attribute called 'minClientVersion' can now indicate the minimum NuGet client version required to consume a package.
This feature helps package author to specify that a package will work only after a particular version of NuGet. As new nuspec features are added after NuGet 2.5, packages will be able to claim a minimum NuGet version.
<metadata minClientVersion="2.6">
If the user has NuGet 2.5 installed and a package is identified as requiring 2.6, visual cues will be given to the user indicating the package will not be installable. The user will then be guided to update their version of NuGet.
This will improve upon the existing experience where packages begin to install but then fail indicating an unrecogized schema version was identified.
Before NuGet 2.5, when a package was installed that depended on a package already installed in the project, the dependency would be updated as part of the new installation, even if the existing version satisfied the dependency.
Starting with NuGet 2.5, if a dependency version is already satisifed, the dependency will not be updated during other package installations.
The scenario:
In NuGet 2.2 and older:
In NuGet 2.5 and newer:
For more background on this change, read the detailed work item as well as the related discussion thread.
If you are troubleshooting NuGet.exe or just curious what HTTP requests are made during operations, the '-verbosity detailed' switch will now output all HTTP requests made.
Before NuGet 2.5, if you attempted to run 'NuGet.exe push' to a package source based on a UNC path or local directory, the push would fail. With the recently added hierarchical configuration feature, it had become common for NuGet.exe to need to target either a UNC/folder source, or an HTTP-based NuGet Gallery.
Starting with NuGet 2.5, if NuGet.exe identifies a UNC/folder source, it will perform the file copy to the source.
The following command will now work:
NuGet.exe push -source \\mycompany\repo\ mypackage.1.0.0.nupkg
NuGet.exe commands that acccess configuration (all except 'spec' and 'pack') now support a new '-ConfigFile' option, which forces a specific config file to be used in place of the default config file at %AppData%\nuget\nuget.config.
Example:
NuGet.exe sources add -name test -source http://test -ConfigFile C:\test\.nuget\nuget.config
With NuGet 2.5, the NuGet tooling is now available for Native projects in Visual Studio. We expect most native packages will utilize the MSBuild imports feature above, using a tool created by the CoApp project. For more information, read the details about the tool on the coapp.org website.
The target framework name of "native" is introduced for packages to include files in \build, \content, and \tools when the package is installed into a native project. The \lib folder is not used for native projects.