Myget server show Nuget package license as UnKnown

155 Views Asked by At

I followed the instructions of nuget license here.

I use the following code in myproject.csproj:

 <PropertyGroup>
    <PackageLicenseFile>LICENSE.md</PackageLicenseFile>
  </PropertyGroup>

  <ItemGroup>
    <None Include="..\LICENSE.md" Pack="true" PackagePath=""/>
  </ItemGroup>

The Nuget package is built correctly.
No build error or warning related to license. The license file is included in the package correctly.

When I Inspect the nuspec file in the package, I find this xml code:

    <license type="file">LICENSE.md</license>
    <licenseUrl>https://aka.ms/deprecateLicenseUrl</licenseUrl>

In MyGet feed package, it show package license as UnKnown and point to: 'https://aka.ms/deprecateLicenseUrl'.

My Question:

Why the nuspec file included in the package show deprecateLicenseUrl?

What I missed to show license in MyGet correctly?

1

There are 1 best solutions below

0
On

Why the nuspec file included in the package show deprecateLicenseUrl?

Embedded licenses were added to the NuGet client in NuGet 4.9, which corresponds to Visual Studio 2017 15.9, around November 2018. Before then, only license URLs were supported. This means that Visual Studio 2017 15.8 and earlier, as well as Visual Studio 2015 and earlier do not support embedded licenses, and so the license URL pointing to the documentation is added so that they show something, allowing customers to understand why they can't see the real license and instructions on how to find the actual license for the package. Similarly, it means that NuGet feeds need to change to support embedded licenes. The NuGet client team worked with the nuget.org team to make sure they both supported it at the same time, but the NuGet team has no direct influence of other NuGet feed implementations. If MyGet has not updated to support embedded licenses, it can use the lincense url backwards compatibility aimed at users of old versions of Visual Studio.

What I missed to show license in MyGet correctly?

You could use both embedded license and a custom license URL, but then NuGet will generate warnings when you pack, and your package may be rejected if you try to pubilsh to nuget.org. Otherwise you haven't missed anything, it just sounds like MyGet hasn't "kept up" with changes to NuGet.