Reputation: 3
I have read quite a number of discussions on this specific and/or related issues(see Article1 and Article2) but all of them seem to have been asked some time ago. Given the changes with NuGet 2.8+ , I was wondering if some has been able to find a way to solve this problem.
What I am trying to do is ensure my project is always building with the latest version of certain (not necessarily all) NuGet packages WITHOUT altering project files. The reason I cant alter the project files is because they are in checked into Source Control (Visual Studio) and the build is automatically triggered inside our Continuous Integration pipeline (which can not alter files) when one of the "upsteam" projects creates a newer version of the NuGet package.
So far i've been able to achieve the desired result of updating the build at build time with the latest version of the NuGet packages this with help from this Article3 but this in fact alters the *.csproj file(using the NuGet Update command) making this not a viable option for us.
Any suggestions on this is appreciated.
Upvotes: 0
Views: 1297
Reputation: 47987
If you are using NuGet version 2.x then this is not possible. When updating the NuGet package NuGet version 2 will modify your project files and the packages.config file.
You could look at using NuGet version 3, if your project type is supported, since it allows you to specify a range using wildcards (e.g. 1.*).
Another alternative here would be to use Paket. You can update NuGet packages from the command line using Paket and it will not modify your project files. However you have to use Paket for all NuGet changes and not the Visual Studio NuGet Package Manager.
The final option would be to not use NuGet at all for those NuGet packages, instead have a separate build step that downloads, updates them and extracts them to a common lib directory which your project references.
Upvotes: 3