Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Test NuGet package Installation on C# project in Azure Pipeline

Is it possible, as part of a CI process for NuGet package creation, to install a newly created package to a project, residing in the repository? So that the installation can be tested. It's easy to do using Visual Studio UI, but how to do it on a newly created azure pipeline worker automatically?

like image 827
Andrey Ershov Avatar asked Jul 28 '19 19:07

Andrey Ershov


1 Answers

Install NuGet package on the project in Azure Pipeline

I am afraid it is impossible to install NuGet package on the project in Azure Pipeline.

Because NuGet CLI install command line just Installs a package into the current project but does not modify projects or reference files (packages.config).:

enter image description here

It is like the command line nuget restore, just download the packages not install it.

To install the package to the project, we need modify the project file via access to visual studio objects:

https://github.com/NuGet/Home/issues/1512

So it should be impossible to install NuGet packages out of Visual Studio, check my another thread for some details.

Besides, we also do not recommend to install NuGet package in Azure Pipeline. If we install a newly created package to a project automatically, it will use the scripts to modify our Repos, which is not recommended and safe.

Personally, the correct process is:

  • Create the new package in the Azure pipeline.
  • Publish the new package to the Artifacts or any other nuget feed.
  • Install/Update the new package to the project with Visual Studio and test it.
  • Update the new package version to the Repos.

Hope this helps.

like image 178
Leo Liu-MSFT Avatar answered Oct 17 '22 08:10

Leo Liu-MSFT