Search code examples
asp.net-corenuget

How to Lock a Package Version from Nuget Updates


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?

Nuget Package Manager


Solution

  • The two ways I can think to do this:

    • Create a new Nuget package that you dont rev that contains the references you want to lock. that way they would just never show up in the update list.
    • Create a test like @mason suggested. I would start with code that finds the assembly with the name you want to lock then you can check its version. you can either write it as an exact match (easist) or not to exceed a specific version (more work but you could use an earlier version)