.NET Core Solution: Get licenses from used NuGet packages
Posted on May 17, 2024 (Last modified on October 26, 2024) • 4 min read • 685 wordsHow to get a txt or Excel file for all license of used Nuget package in your .NET Core Solution
ToDo: Get all licenses from used NuGet Packages in the Visual Studio Solution. Create a license text file or Excel file with all found license and save all license as a separate Text File.
Best solution so far: jump to Solution 5 or Solution 6
|
|
Output result (Nuget Package Name, License Url):
xunit.runner.visualstudio https://raw.githubusercontent.com/xunit/xunit/master/license.txt NSubstitute https://github.com/nsubstitute/NSubstitute/raw/master/LICENSE.txt Good… but the direct reference project NuGet package. Need also the License of all dlls.
Try out with the PowerShell script. Save the code as DownloadNugetLicense.ps1 in the VS solution director.
Run the PowerShell Script with ./DownloadNugetLicense.ps1 in the Visual Studio Package Manager Console.
PowerShell Code:
|
|
Not perfect – I also need the license for the used Dlls inside any NuGet Package.
Abp.AspNetCore; https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/LICENSE; The MIT License (MIT) Abp.AspNetCore.SignalR; https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/LICENSE; The MIT License (MIT) Abp.AutoMapper; https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/LICENSE; The MIT License (MIT) Abp.Castle.Log4Net; https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/LICENSE; The MIT License (MIT) Abp.HangFire; https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/LICENSE; The MIT License (MIT) Abp.RedisCache; https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/LICENSE; The MIT License (MIT) Abp.TestBase; https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/LICENSE; The MIT License (MIT) Abp.ZeroCore; https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/LICENSE; The MIT License (MIT) Abp.ZeroCore.EntityFrameworkCore; https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/LICENSE; The MIT License (MIT) AspNet.Security.OpenIdConnect.Server; http://www.apache.org/licenses/LICENSE-2.0.html; Castle.Core; http://www.apache.org/licenses/LICENSE-2.0.html;
|
|
Visual Studio 2017 Extension: List license of all NuGet packages inside the ‘packages’ folder of any Visual Studio solution. Refer license from the Nuget ProjectUrl / LicenseUrl in the package metadata. Download license and license text from GitHub, spdx.org.
Visual Studio Marketplace: Package Licenses
Package Folder
Package Folder not exist for the solution?
NuGet.Config
Create Nuget.Config for the Visual Studio solution:
|
|
Create your own license file output (Excel or TEXT) with the following .NET Core Console Project:
https://github.com/do-it-ger/DoitPackagesLicenses
A .net core tool to print the licenses of a project. This tool support .NET Core and .NET Standard projects.