0

Is it possible to auto accept license so that the popup, e.g. one below, will not show up whenever I want to install a nuget package.

If I have to install 5 nuget packages, it shows up 5 items. Ideally, it will auto-accept all and popup is not shown.

enter image description here

Pingpong
  • 7,681
  • 21
  • 83
  • 209
  • Sorry but as I know, it's not supported scenario in VS for now. You can check my answer below for more details, especially starting from #1 to the end. Feel free to let me know if it's helpful or not :-) – LoLance Dec 18 '19 at 06:33

1 Answers1

3

Stop License Acceptance popup by Auto Accepting Nuget within visual studio

As I know, for now this is not a supported behavior in VS IDE. VS IDE itself doesn't have this option to turn on/off auto-accepting the lisense of one nuget package.

If I have to install 5 nuget packages, it shows up 5 items.

Whether a License Acceptance popup will show up in Visual Studio actually depends on whether the author(s) of the nuget package asks it to do so. So this behavior for now is only controlled by the authors of the nuget package, not VS IDE.

Let me describe it for you:

When one developer wants to generate one nuget package from his project, he can uses xx.nuspec to define the metadata of the package to be published. He can set the package ID,Authors,version,description... in it. After he use something like nuget pack xx.nuspec or other similar pack commands, now the package he developed containes the metadata.

(A xx.nupkg is a xx.zip file, rename it to xx.zip and open it we can see its content)

After that he can publish the package to nuget.org or other feeds, then when we consume it in VS we can see the metadata like:

enter image description here

#1.Now let's talking about the Main Cause of the behavior you met. See requireLicenseAcceptance:

This is one element the author can specify in xx.nuspec file to determine:

A Boolean value specifying whether the client must prompt the consumer to accept the package license before installing the package.

So the behavior you met is controlled by authors, not IDE.

#2.To respect the choice of the authors who developed the packages, VS IDE will prompt the License Acceptance popup when we install one package whose author sets the requireLicenseAcceptance=true.

#3.As for the auto accept license that you mentioned in the question, we don't recommend that you auto-accept all of them. As Matt described here: Not all NuGet packages are free on nuget.org but(though?) a lot of them are free. So some packages may have special lisense that need us to review.

And actually as I know, there's no option from VS IDE or VS extensions is supported to do that...

In addition: There's an open discussion about the requireLicenseAcceptance property in Github/nuget here. You can track that issue and get the notifications if there's any update.

Hope all above helps and feel free to correct me if I misunderstand anything:)

Community
  • 1
  • 1
LoLance
  • 25,666
  • 1
  • 39
  • 73
  • One possible support in the future for VS is to provide settings that have more flexibility. For example, when the nuget is not free, or different licence type, or author list, it pops up. If it is free, defined authors (e.g. Microsoft), defined licence types, it auto-accepts. I will accept your answer because VS don't support it at the moment. – Pingpong Dec 18 '19 at 19:05
  • Good idea, I suggest you can post a feature request in our User Voice forum: [Developer Community](https://developercommunity.visualstudio.com/spaces/8/index.html) , you can share your idea there and if it gets enough votes, the product team would seriously consider about that. Thanks your suggestion and help to make VS better :) – LoLance Dec 19 '19 at 02:19