Reputation: 30208
I am using Aspose
to do some doc management and our license only gives us a year of updates, which now has expired. So when, in typical fashion, we update our packages and get the latest version of Aspose
it breaks our app. Is there a way to lock down those packages from showing up in the Nuget Package Updates
list, or at least to prevent changes to the versions via the the Nuget Update
process? I looked at various Nuget
and Microsoft
references and didn't see anything, but am hoping someone here knows some secret sauce?
Upvotes: 13
Views: 6001
Reputation: 60616
With the latest PackageReference
format simply add square brackets around the version number in .csproj
file:
<PackageReference Include="MYPACKAGE" Version="[2.6.0]" />
This will freeze the dependency version and it won't show up in updates.
Docs: https://learn.microsoft.com/en-us/nuget/concepts/package-versioning?tabs=semver20sort#version-ranges
P.S. This is an old question but it still shows up as the #1 Google result for me, so I added another answer.
Upvotes: 19
Reputation: 63
I know this question is old but there is an attribute you can add in the packages.config file that locks the version as Matt Ward answered here:
Restrict nuget package updates to current versions for some packages
For us it was the UmbracoCms package that had breaking changes in the next version.
<package id="UmbracoCms" version="7.15.5" allowedVersions="[7.15.5]" targetFramework="net472" />
You can find more information about version restrictions here
Upvotes: 4
Reputation: 40918
One way is to just stop using NuGet for it and reference the DLLs manually.
bin
folder (where your compiled project is) and copy any Aspose.*
files to a new folder in your project directory.Upvotes: 1
Reputation: 31
The two ways I can think to do this:
Upvotes: 2