Home: csproj equivalent to licence

Created on 27 Jul 2019  路  5Comments  路  Source: NuGet/Home

I usually push a nuget by using

dotnet pack -c release

followed by:

nuget push <package> -source nuget.org

Today I had to upload manually and it showed me the following warning:

All published packages should have license information specified.

The documentation says to use license\license.txt in the .nuspec. I prefer not to have to update the .nuspec everytime and update the csproj file instead. I can't find any documentation pointing to what is to be used in the .csproj in order to generate this license tag. I have tried :

 <PackageLicense>none</PackageLicense>
  <License>none</License>

Trying type="file" crashes the project. I have also tried adding a License.txt file.

Pack Question Docs

Most helpful comment

I'll add the link to the "license-url-deprecation" section.

All 5 comments

Please refer to https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#packing-a-license-expression-or-a-license-file.

https://github.com/NuGet/Samples/blob/master/PackageLicenseFileExample/PackageLicenseFileExample.csproj
or
https://github.com/NuGet/Samples/blob/master/PackageLicenseExpressionExample/PackageLicenseExpressionExample.csproj

//cc @karann-msft @mikejo5000

I'd imagine there's a discoverability issue with this topic.

@neville-nazerane Can you point us to the doc page that you were looking at?
We'd like to understand whether we can do something to improve the docs so that other customers like yourself can discover the solution without having to create an issue.

Thank you.

Basically, when I upload a nuget package, I get the following message:

We found the following issue(s):
All published packages should have license information specified. Learn more.
We recommend that you fix these issues and upload a new package. Read more

These links say we need the to add the license information but don't mention (or provide a link to) do this from the csproj files.

I feel using csproj (especially for .net standard or .net core projects) is cleaner and modern than modifying. Even if not documented, it should be linked from the page (unless I am missing something).

If you follow the https://docs.microsoft.com/en-us/nuget/reference/nuspec#license example from learn more, there's a:

For the MSBuild equivalent, take a look at Packing a license expression or a license file.

which is a link to https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#packing-a-license-expression-or-a-license-file.

But point taken, too many clicks to get to it :)

@karann-msft

Maybe https://docs.microsoft.com/en-us/nuget/consume-packages/finding-and-choosing-packages#license-url-deprecation should container pointers to the targets pack in addition to the nuspec example?

Currently it's 3 clicks to get to the desired example, maybe it should be shortened?

I'll add the link to the "license-url-deprecation" section.

@nkolev92 Yes. Point isn't exactly that it is three clicks away but that no one would think this is the exact path to get to the csproj/dotnet cli/MSBuild documentation.

I would suggest having tabs at some point saying "nuspec" and "csproj" in places where something like this is documented. Similar to how vs and vs code are documented side by side in several docs.

Was this page helpful?
0 / 5 - 0 ratings