diff --git a/NuGet.Docs/ndocs/Schema/nuspec.md b/NuGet.Docs/ndocs/Schema/nuspec.md index 46cd51c2..d7e1431f 100644 --- a/NuGet.Docs/ndocs/Schema/nuspec.md +++ b/NuGet.Docs/ndocs/Schema/nuspec.md @@ -5,134 +5,152 @@ A .nuspec file is a manifest that uses XML to describe a package. NuGet uses the At the minimum, you need the following elements in in the metadata of your .nuspec file.
Element | Description | -
---|---|
id | -
- The unique identifier for the package. This is the package name that is shown
- when packages are listed using the Package Manager Console. These are also used
- when installing a package using the Install-Package command within the Package
- Manager Console. Package IDs may not contain any spaces or characters that are
- invalid in an URL. In general, they follow the same rules as .NET namespaces do.
- So Foo.Bar is a valid ID, Foo! and Foo Bar are not.
- |
-
version | -The version of the package, in a format like 1.2.3 . |
-
title | -- The human-friendly title of the package displayed in the Manage NuGet Packages - dialog. If none is specified, the ID is used instead. - | -
authors | -A comma-separated list of authors of the package code. | -
owners | -- A comma-separated list of the package creators. This is often the - same list as in authors. This is ignored when uploading the package - to the NuGet.org Gallery. - | -
description | -
- A long description of the package. This shows up in the right pane of the
- Add Package Dialog as well as in the Package Manager Console when listing
- packages using the Get-Package command.
- |
-
Element | Description | +
id | +
+
+ The unique identifier for the package. This is the package name that is shown
+ when packages are listed using the Package Manager Console. These are also used
+ when installing a package using the Install-Package command within the Package
+ Manager Console. Package IDs may not contain any spaces or characters that are
+ invalid in an URL. In general, they follow the same rules as .NET namespaces do.
+ So
+ Package IDs are treating as case-insensitive strings. |
+
version | +The version of the package, in a format like 1.2.3 . |
+
title | ++ The human-friendly title of the package displayed in the NuGet.org Gallery and + older versions of the Manage NuGet Packages dialog in Visual Studio. If no title + is specified, the ID is used instead. + | +
authors | +A comma-separated list of authors of the package code. | +
description | +
+ A long description of the package. This shows up in the right pane of the
+ Add Package dialog as well as in the Package Manager Console when listing
+ packages using the Get-Package command.
+ |
+
owners | ++ A comma-separated list of the package creators. This is often the + same list as in authors. This is ignored when uploading the package + to the NuGet.org Gallery. + | +
Element | Description | -|
---|---|---|
releaseNotes | -- v1.5 - A description of the changes made in each release of the package. This field - only shows up when the _Updates_ tab is selected and the package is an update - to a previously installed package. It is displayed where the Description would - normally be displayed. - | -|
summary | -- A short description of the package. If specified, this shows up in the middle pane - of the Add Package Dialog. If not specified, a truncated version of the description - is used instead. - | -|
language | -The locale ID for the package, such as en-us. | -|
projectUrl | -A URL for the home page of the package. | -|
iconUrl | -A URL for the image to use as the icon for the package in the Manage NuGet Packages dialog box. This should be a 64x64-pixel .png file that has a transparent background. | -|
licenseUrl | -A link to the license that the package is under. | -|
copyright | -v1.5 Copyright details for the package. | -|
requireLicenseAcceptance | -A Boolean value that specifies whether the client needs to ensure that the package license (described by licenseUrl) is accepted before the package is installed. | -|
dependencies | -The list of dependencies for the package. For more information, see Specifying Dependencies later in this document. | -|
references | -v1.5 Names of assemblies under lib that are added as project references. If unspecified, all references in lib are added as project references. When specifying a reference, only specify the name and not the path inside the package. | -|
frameworkAssemblies | -v1.2 The list of .NET Framework assembly references that this package requires. These are references to assemblies that exist in the .NET Framework and thus should already be in the GAC for any machine. Specifying framework assembly references ensures these references are added when installing the package. | -|
tags | -A space-delimited list of tags and keywords that describe the package. This information is used to help make sure users can find the package using searches in the Add Package Reference dialog box or filtering in the Package Manager Console window. | -|
developmentDependency | -v2.8 A Boolean value that specifies whether the package will be marked as a development-only dependency in the packages.config. This will cause the package to be excluded from the dependency list when the referencing project itself is later packaged. | -|
contentFiles | -v3.3A collection of files that should be referenced in the consuming project. These files can be specified with a set of - attributes that instruct the project system how they should be used in the project. | -|
Element | Description | +|
releaseNotes | ++ v1.5 + A description of the changes made in each release of the package. This field + only shows up when the Updates tab is selected and the package is an update + to a previously installed package. It is displayed where the Description would + normally be displayed. + | +|
summary | ++ A short description of the package. If specified, this shows up in the middle pane + of the Add Package Dialog. If not specified, a truncated version of the description + is used instead. + | +|
language | +The locale ID for the package, such as en-us . |
+ |
projectUrl | +A URL for the home page of the package. | +|
iconUrl | +A URL for the image to use as the icon for the package in the Manage NuGet Packages dialog box. This should be a 64x64-pixel .png file that has a transparent background. | +|
licenseUrl | +A link to the license that the package is under. | +|
copyright | +v1.5 Copyright details for the package. | +|
requireLicenseAcceptance | +A boolean value that specifies whether the client needs to ensure that the package license (described by licenseUrl) is accepted before the package is installed. | +|
dependencies | +The list of dependencies for the package. For more information, see Specifying Dependencies later in this document. | +|
references | +v1.5 Names of assemblies under lib that are added as project references. If unspecified, all references in lib are added as project references. When specifying a reference, only specify the name and not the path inside the package. | +|
frameworkAssemblies | +v1.2 The list of .NET Framework assembly references that this package requires. These are references to assemblies that exist in the .NET Framework and thus should already be in the GAC for any machine. Specifying framework assembly references ensures these references are added when installing the package. | +|
tags | +A space-delimited list of tags and keywords that describe the package. This information is used to help make sure users can find the package using searches in the Add Package Reference dialog box or filtering in the Package Manager Console window. | +|
developmentDependency | +v2.8 A Boolean value that specifies whether the package will be marked as a development-only dependency in the packages.config. This will cause the package to be excluded from the dependency list when the referencing project itself is later packaged. | +|
contentFiles | +v3.3A collection of files that should be referenced in the consuming project. These files can be specified with a set of + attributes that instruct the project system how they should be used in the project. | +|
minClientVersion | -v2.5 or above Specifies the minimum version of the NuGet client that can install this package. This requirement is enforced by both the NuGet Visual Studio extension and nuget.exe program. | +v2.5 Specifies the minimum version of the NuGet client that can install this package. This requirement is enforced by both the NuGet Visual Studio extension and nuget.exe program. | +
packageTypes | ++ v3.5 Specifies the type of the + package. This is important if the package is something other than a traditional + dependency package. For more information, see the package + type documentation. + |
myproject.nuspec
file adjacent to the myproject.csproj
file may contain the following replacement tokens which
are populated by the values within the project. The file may also contain other replacement tokens that will be specified
using the [nuget pack -Properties](/ndocs/tools/nuget-cli-reference#pack) feature.
@@ -158,7 +176,7 @@ using the [nuget pack -Properties](/ndocs/tools/nuget-cli-reference#pack) featur
AssemblyVersionAttribute
. If the assembly’s AssemblyInformationalVersionAttribute
is specified, that one is used instead.AssemblyVersionAttribute
. If the assembly's AssemblyInformationalVersionAttribute
is specified, that one is used instead.<reference>
elements, each of which
+ This element contains a set of reference
elements, each of which
specifies an assembly that will be referenced by the project. The existence of
this element overrides the convention of pulling everything in the lib
folder. More info below.
dependencies
element contains a set of group
elements. Each group contains zero or more dependency
element and a target framework attribute. All dependencies inside a group are installed together if the target framework is compatible with the project's framework profile.
- group
element.
Attribute | Description | |
---|---|---|
targetFramework |
- **Optional**. The target framework of the group. If not set, the group acts as a fallback group, which behaves exactly as before version 2.0 | +Optional. The target framework of the group. If not set, the group acts as a fallback group, which behaves exactly as before version 2.0 |
dependency
element is the same as described in previous section.
-A package can specify package dependencies in either two formats: either with a flat list of `dependency
as in pre-2.0, or in groups. However, mixing the two formats is disallowed. For example, the following snippet is **invalid** and will be rejected by NuGet.
- <references />
element to explicitly specify assemblies that the target project should
reference.
For example, if you add the following:
- lib
folder even if there are other assemblies in the folder.
If this element is omitted, then the usual behavior applies, which is to reference every assembly
in the lib folder.
@@ -287,58 +306,58 @@ assemblies to be located next to the runtime assemblies, but excluded from proje
## Specifying Explicit Assembly References in version 2.5 and above
-Starting from [version 2.5] (/Release-Notes/NuGet-2.5), package assembly references can be specified to vary according to the framework profile of the target project. The `references
element contains a set of group
elements. Each group contains zero or more reference
element and a target framework attribute. All references inside a group are installed together if the target framework is compatible with the project's framework profile.
- group
element.
Attribute | Description | |
---|---|---|
targetFramework |
- **Optional**. The target framework of the group. If not set, the group acts as a fallback group, which behaves exactly as before version 2.5. | +Optional. The target framework of the group. If not set, the group acts as a fallback group, which behaves exactly as before version 2.5. |
reference
element is the same as described in previous section.
-A package can specify package references in either two formats: either with a flat list of `reference
as in pre-2.5, or in groups. However, mixing the two formats is disallowed. For example, the following snippet is **invalid** and will be rejected by NuGet.
- frameworkAssemblies
element, a child element of the metadata element, allows you to
specify a set of frameworkAssembly elements pointing to a Framework assembly in the GAC. Note the emphasis
on Framework assembly. These assemblies are not included in your package as they are assumed to be on every
machine as part of the .NET Framework.
- src
+attribute and target
attribute respectively.
exclude |
- The file or files to exclude. This is usually combined with a wildcard value in the `src`
- attribute. The `exclude` attribute can contain a semi-colon delimited list of files or
+ The file or files to exclude. This is usually combined with a wildcard value in the src
+ attribute. The exclude attribute can contain a semi-colon delimited list of files or
a file pattern. Using a double wildcard, **, implies a recursive exclude pattern.
|
files
element.
- NuGet does not add references to any dlls that end with '.resources.dll'. Please refer to the following Codeplex discussion: http://nuget.codeplex.com/discussions/280566
### File Element Examples -Let’s look at some example usages of this element to gain a better understanding of how it’s used. +Let's look at some example usages of this element to gain a better understanding of how it's used. #### Single Assembly -Copies a single assembly in the same folder as the NuSpec file into the package’s `lib` folder. +Copies a single assembly in the same folder as the NuSpec file into the package'slib
folder.
-Source Contains: `foo.dll`
+Source Contains: foo.dll
- lib\foo.dll
#### Single Assembly In a deep path
-Copies a single assembly into the package’s `lib\net40` folder so that it only applies to projects
+Copies a single assembly into the package's lib\net40
folder so that it only applies to projects
targeting the .NET 4 framework.
-Source Contains: `foo.dll`
+Source Contains: foo.dll
- lib\net40\foo.dll
#### Set Of DLLs
-Copies a set of assemblies within the `bin\release` folder into the package’s `lib` folder.
+Copies a set of assemblies within the bin\release
folder into the package's lib
folder.
Source contains:
-* `bin\release\MyLib.dll`
-* `bin\release\CoolLib.dll`
+* bin\release\MyLib.dll
+* bin\release\CoolLib.dll
NuSpec File Element
- lib\Mylib.dll
+* lib\coollib.dll
#### DLLs for different frameworks
Source contains:
-* `lib\net40\foo.dll`
-* `lib\net20\foo.dll`
+* lib\net40\foo.dll
+* lib\net20\foo.dll
NuSpec File Element:
- lib\net40\foo.dll
+* lib\net20\foo.dll
Note: The double wildcard implies a recursive search in the source for matching files.
@@ -479,112 +498,112 @@ These instructions define a technique used in pre-3.0 versions of NuGet that inc
Source Contains:
-* `css\mobile\style1.css`
-* `css\mobile\style2.css`
+* css\mobile\style1.css
+* css\mobile\style2.css
NuSpec File Element:
- content\css\mobile\style1.css
+* content\css\mobile\style2.css
#### Content files with directory structure
Source Contains:
-* `css\mobile\style.css`
-* `css\mobile\wp7\style.css`
-* `css\browser\style.css`
+* css\mobile\style.css
+* css\mobile\wp7\style.css
+* css\browser\style.css
NuSpec file element
- content\css\mobile\style.css
+* content\css\mobile\wp7\style.css
+* content\css\browser\style.css
#### Content File with deep path
-Source Contains: `css\cool\style.css`
+Source Contains: css\cool\style.css
- content\style.css
#### Content File copied to Folder with dot in name
- content\images\foo.bar\neatpick.png
Note: Because the target "extension" doesn't match the src extension, NuGet treats it as a directory.
#### Content files without extensions
-To make sure extensionless files are captured by wildcard match use `**` or `*`
+To make sure extensionless files are captured by wildcard match use **
or *
-Source Contains: `flags\installed`
+Source Contains: flags\installed
- flags\installed
#### Content file with deep path and deep target
- content\css\cool\style.css
Note: This also works:
- content\css\ie.css
### Excluding files in the NuSpec
-The `file
element within a NuSpec file can be used to include a specific file or a set of files
using a wildcard. When using a wildcard, there's no way to exclude a specific subset of the included
files. For example, suppose you want all text files within a directory except a specific one.
- files
element as demonstrated above.
Files child-elements of contentFiles in the nuspec are applied from top to bottom, with the topmost elements taking precedence over lower elements in the collection. These elements apply to entries in the contentFiles folder of the package. Type of content that work very well in this model include:
@@ -598,33 +617,33 @@ Content shall be stored in the package in folders that match this pattern:
/contentFiles/{codeLanguage}/{TxM}/{any?}
-* codeLanguages may be `cs`, `fs`, `vb`, `any` or the lowercase equivalent of a given **$(ProjectLanguage)**
+* codeLanguages may be cs
, fs
, vb
, any
or the lowercase equivalent of a given $(ProjectLanguage)
* TxM is any legal target framework moniker that NuGet supports
* Any folder structure may be appended to the end of this syntax.
Examples of legal folder locations include:
-Language and framework agnostic: `/contentFiles/any/any/config.xml`
-net45 content for all languages: `/contentFiles/any/net45/config.xml`
-CSharp specific content for net45 and up: `/contentFiles/cs/net45/sample.cs`
+Language and framework agnostic: /coNtentFiles/any/any/config.xml
+net45 content for all languages: /coNtentFiles/any/net45/config.xml
+CSharp specific content for net45 and up: /coNtentFiles/cs/net45/sample.cs
-Empty folders can use `_._` to opt out of providing content for certain combinations of language and TxM:
+Empty folders can use _._
to opt out of providing content for certain combinations of language and TxM:
/contentFiles/vb/any/code.vb
/contentFiles/cs/any/_._
-#### NuSpec contentFiles / files attributes
+#### NuSpec contentFiles or files attributes
Attribute | Description | |
---|---|---|
include | +include | [Required attribute] Include provides either a file path or a wild card path. All matching files from the contentFiles folder will have the attributes for that files node applied. Examples: **/* , **/*.cs , any/any/myfile.txt , **/net*/* . |
exclude | +exclude | Exclude provides either a file path or a wild card path. All matching files will be excluded from the include. |
Attribute | -Value | +Attribute | +Value |
---|---|---|---|
buildAction | @@ -661,7 +681,7 @@ Empty folders can use `_._` to opt out of providing content for certain combinat
System.Web
, System.Net
+* Project targeting .NET4 Client Profile -> System.Net
+* Project targeting Silverlight 3 -> System.Json
+* Project targeting Silverlight 4 -> System.Windows.Controls.DomainServices
+* Project targeting WindowsPhone -> Microsoft.Devices.Sensors