1

I'm calling the "Nuget Restore Task" and "Nuget Update Task" before I build Solution B in a TFS CI Build definition. Solution B references the Nuget Package created from Solution A which I built prior to Solution B.

I also have a retention policy for my CI Nuget packages so only the last 5 packages are kept.

The point of this is for Solution B to also build using the latest CI Nuget package for Solution A.

If the Nuget package for Solution A which is referenced by Solution B exists this all works. If the Nuget package for Solution A has been removed from the store the "Nuget Restore Task" fails. This means that the "Nuget Update Task" does not get a chance to execute which would update the Solution A reference to the latest Nuget package.

Does anyone have any suggestions for making this work? Or perhaps an alternative approach?

PatrickNolan
  • 1,671
  • 2
  • 20
  • 40
  • `If the Nuget package for Solution A has been removed from the store the "Nuget Restore Task" fails` why removed the packages from the store ? For CI, it will automatically use the latest build (Nuget Package here), based on your retention policy, the CI Nuget packages will keep last 5 packages. So the latest package shoule be there. – Andy Li-MSFT Jan 23 '18 at 06:22
  • If you just want to use the latest Nuget package created from solution A, you just need to add a copy step to copy the Nuget package to solution B . Whatever you can reference this thread : https://stackoverflow.com/questions/15027256/cannot-automatically-update-a-nuget-package-to-the-latest-version-during-build – Andy Li-MSFT Jan 23 '18 at 06:27
  • Hey guys thanks for the responses. I'm trying to avoid updating the reference version in the csproj files associated with Solution B during my build (although I guess this could be achieved via a regex find\replace step). @AndyLi-MSFT the latest package is not there because the checked-in csproj file is referencing a version which that more than 5 packages old. Does anyone have any other ideas? – PatrickNolan Jan 23 '18 at 10:47
  • No, you have to update the reference version in the csproj files if the CI Nuget packages have different versions every time. Another possibility is that drop the libraries which built from solution A to a specific folder without the version info changed, then add a copy step to copy the referenced libraries from that folder to solution B. – Andy Li-MSFT Jan 24 '18 at 03:03

0 Answers0