Browse Source
NuGet allows you to define a range of package versions that are allowed in your project. http://docs.nuget.org/docs/reference/versioning This is done by editing the packages.config file and adding an allowedVersions attribute for the installed package. For example, the following restricts jQuery to be any version from 1.4 up to but not including version 1.8. <package id="jQuery" version="1.4.1" targetFramework="net40" allowedVersions="[1.4.1,1.8)" /> The NuGet addin now supports this information when updating the package from the PowerShell console when using the Update-Package cmdlet when no version is specified. With the above example when updating jQuery the NuGet addin will now update to jQuery 1.7.2 and not the latest 2.1.1 version. Previously it would update to the latest version of the NuGet package. Note that if you search for another NuGet package and install a later version that is outside the allowed range it will still install. This is the same behaviour as Visual Studio. The allowedVersions attribute is to prevent you from accidentally updating the version but you can explicitly pick a later NuGet package and update to it with the Manage Packages dialog.pull/505/merge
8 changed files with 112 additions and 3 deletions
@ -0,0 +1,39 @@
@@ -0,0 +1,39 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using ICSharpCode.PackageManagement.Design; |
||||
using NuGet; |
||||
|
||||
namespace PackageManagement.Tests.Helpers |
||||
{ |
||||
public class FakePackageRepositoryWithConstraintProvider : FakePackageRepository, IPackageConstraintProvider |
||||
{ |
||||
DefaultConstraintProvider constraintProvider = new DefaultConstraintProvider(); |
||||
|
||||
public IVersionSpec GetConstraint(string packageId) |
||||
{ |
||||
return constraintProvider.GetConstraint(packageId); |
||||
} |
||||
|
||||
public void AddConstraint(string packageId, IVersionSpec versionSpec) |
||||
{ |
||||
constraintProvider.AddConstraint (packageId, versionSpec); |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue