-
Notifications
You must be signed in to change notification settings - Fork 482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve docs on pack's CopyToOutput and Flatten #3274
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,6 +113,23 @@ The following table describes the MSBuild properties that can be added to a proj | |
| `NuspecBasePath` | Base path for the *.nuspec* file. For more information, see [Packing using a .nuspec](#packing-using-a-nuspec-file). | | ||
| `NuspecProperties` | Semicolon separated list of key=value pairs. For more information, see [Packing using a .nuspec](#packing-using-a-nuspec-file). | | ||
|
||
### package item inputs | ||
|
||
As described in the section on [including content in your package](#including-content-in-a-package), there is certain [item metadata](/visualstudio/msbuild/msbuild-items#item-metadata) that can be added to [MSBuild items](/visualstudio/msbuild/msbuild-items), which pack will use. | ||
|
||
| Metadata | Description | | ||
|:--|:--| | ||
| Pack | The file that this item represents should be included in the package. For items of type `Content` this defaults to the value of the `IncludeContentInPack` property. For all other item types, this defaults to `false`. | | ||
| PackagePath | The path within the package that the file will be located. For items of type `Content`, this defaults to `content\;contentFiles\any\any\`. For all other items types, there is no default value. | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm too lazy to edit the PR right now, but I think it would be worthwhile mentioning that this metadata allows package authors to put any file in any location in the package, even ones that are not part of any NuGet convention. |
||
|
||
The following item metadata only apply to files in the package that follow the correct `contentFiles/{language}/{target_framework}/**/*` naming convention, and the project using the package must be using `PackageReference` (not *packages.config*). | ||
More information can be found in on [including content in your package](#including-content-in-a-package). | ||
|
||
| Metadata | Description | | ||
|:--|:--| | ||
| PackageCopyToOutput | The file's `CopyToOutput` item metadata will be set the specified value in the project using the package. | | ||
| PackageFlatten | The file's `Flatten` item metadata will be set to the specified value in the project using the package. | | ||
Comment on lines
+130
to
+131
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd love to link to some docs where customers can learn more about CopyToOutput and Flatten, but I can't find any Does anyone know where these are documented? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rainer pointed me to I guess this is what I still haven't found docs on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd add BuildAction here. In general, the BuildAction defaults to the item type. |
||
|
||
## pack scenarios | ||
|
||
### Suppressing dependencies | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the nuspec allows files under
contentFiles/
to set whatever item type they want, for example, you could havecontentFiles/cs/any/stuff.cs
and make it a<Compile
item, not<Content
.@nkolev92 do you remember how to specify this? I didn't have much of a search yet, so if you don't know, don't waste time looking for it yourself, I'm just hoping you can save me some time 😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BuildAction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically this: https://github.com/NuGet/NuGet.Client/blob/b869c3cc0e0012e297e9f40742daab4168c25d27/src/NuGet.Core/NuGet.Build.Tasks.Pack/PackTaskLogic.cs#L751-L755.