Skip to content

Commit 0f56541

Browse files
authored
license docs (NuGet#1168)
* Update Creating-a-Package.md * Update nuspec.md * Update nuspec.md * Update nuspec.md * Update nuspec.md * Update Creating-a-Package.md * Update nuspec.md
1 parent f39af67 commit 0f56541

File tree

2 files changed

+53
-4
lines changed

2 files changed

+53
-4
lines changed

docs/create-packages/Creating-a-Package.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ Common optional properties:
5656
- Copyright information
5757
- A short description for the [Package Manager UI in Visual Studio](../tools/package-manager-ui.md)
5858
- A locale ID
59-
- Home page and license URLs
59+
- Project URL
60+
- License as an expression or file (`licenseUrl` is being deprecated, use the [`license` nuspec metadata element](../reference/nuspec#license))
6061
- An icon URL
6162
- Lists of dependencies and references
6263
- Tags that assist in gallery searches
@@ -81,11 +82,14 @@ The following is a typical (but fictitious) `.nuspec` file, with comments descri
8182
users to easily find other packages by the same owners.
8283
-->
8384
<owners>dejanatc, rjdey</owners>
84-
85-
<!-- License and project URLs provide links for the gallery -->
86-
<licenseUrl>http://opensource.org/licenses/MS-PL</licenseUrl>
85+
86+
<!-- Project URL provides a link for the gallery -->
8787
<projectUrl>http://github.com/contoso/UsefulStuff</projectUrl>
8888

89+
<!-- License information is displayed on the gallery -->
90+
<license type="expression">Apache-2.0</license>
91+
92+
8993
<!-- The icon is used in Visual Studio's package manager UI -->
9094
<iconUrl>http://github.com/contoso/UsefulStuff/nuget_icon.png</iconUrl>
9195

docs/reference/nuspec.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,52 @@ A comma-separated list of the package creators using profile names on nuget.org.
7474
#### projectUrl
7575
A URL for the package's home page, often shown in UI displays as well as nuget.org.
7676
#### licenseUrl
77+
> [!Important]
78+
> licenseUrl is being deprecated. Use license instead.
79+
7780
A URL for the package's license, often shown in UI displays as well as nuget.org.
81+
#### license
82+
An SPDX license expression or path to a license file within the package, often shown in UI displays as well as nuget.org.
83+
If you’re licensing the package under a common license such as BSD-2-Clause or MIT, use the associated SPDX license identifier.<br>For example:
84+
`<license type="expression">MIT</license>`
85+
86+
Here is the complete list of [SPDX license identifiers](https://spdx.org/licenses/). NuGet.org accepts only OSI or FSF approved licenses when using license type expression.
87+
88+
If your package is licensed under multiple common licenses, you can specify a composite license using the [SPDX expression syntax version 2.0](https://spdx.org/spdx-specification-21-web-version#h.jxpfx0ykyb60).<br>For example:
89+
`<license type="expression">BSD-2-Clause OR MIT</license>`
90+
91+
If you are using a license that hasn’t been assigned an SPDX identifier, or it is a custom license, you can package a file with the license text. For example:
92+
```xml
93+
<package>
94+
<metadata>
95+
...
96+
<license type="file">LICENSE.txt</license>
97+
...
98+
</metadata>
99+
<files>
100+
...
101+
<file src="licenses\LICENSE.txt" target="" />
102+
...
103+
</files>
104+
</package>
105+
```
106+
The exact syntax of NuGet's license expressions is described below in [ABNF](https://tools.ietf.org/html/rfc5234).
107+
```cli
108+
license-id = <short form license identifier from https://spdx.org/spdx-specification-21-web-version#h.luq9dgcle9mo>
109+
110+
license-exception-id = <short form license exception identifier from https://spdx.org/spdx-specification-21-web-version#h.ruv3yl8g6czd>
111+
112+
simple-expression = license-id / license-id”+”
113+
114+
compound-expression = 1*1(simple-expression /
115+
simple-expression "WITH" license-exception-id /
116+
compound-expression "AND" compound-expression /
117+
compound-expression "OR" compound-expression ) /
118+
"(" compound-expression ")" )
119+
120+
license-expression = 1*1(simple-expression / compound-expression / UNLICENSED)
121+
```
122+
78123
#### iconUrl
79124
A URL for a 64x64 image with transparency background to use as the icon for the package in UI display. Be sure this element contains the *direct image URL* and not the URL of a web page containing the image. For example, to use an image from GitHub, use the raw file URL like <em>https://github.com/\<username\>/\<repository\>/raw/\<branch\>/\<logo.png\></em>.
80125

0 commit comments

Comments
 (0)