Is there any way to get an automatically updated list of all used nuget packages in my solution, including a link to the corresponding license, which I can display within my app?
Running the following from Package Manager Console within Visual Studio gives me the required information:
Get-Project | Get-Package | select Id, Version, LicenseUrl
How to get this list a) automatically updated on each change and b) get it into my app?
Target is to have an Info/About dialog showing all this data.
I found one way, pretty sure it has some limitations...
I'm calling this in the pre-build event:
And here is how
resources\tools\PreBuildScript.ps1
looks like:This gives me an (ugly) textfile
Resources\ThirdPartyLicenseOverview.txt
that I can include as embedded resource to use it within my app.Not the final solution but one step on the way...
As far as I am aware there is nothing currently available to get the list automatically updated on each change and get it into app.
We could not get the license information directly from the command line as part of a CI build, need to create an application to open the .nupkg zip file, extract the license url from the .nuspec file and download the license from this url.
Alternatively, you could use the package manager console window inside Visual Studio and with a bit of PowerShell download the license files. But if you want get it into your app, you could not use the package manager console, in this case you could not get the licenses.
Besides, we could use PowerShell script to get the package Id Version and download the license files, but we still need require someone to run the script to get the Id, version and download the licenses. If you still want to automatically updated on each change, you need use PowerShell to monitor the package.config. The PowerShell script should be invoked and executed automatically after any change in the package, but it will be difficult to achieve.