You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,7 +62,7 @@ item metadata. It can also be turned off by default for all items of a given typ
62
62
The basic item metadata that drive pack inference are:
63
63
64
64
1.**Pack**: *true*/*false*, determines whether inference applies to the item at all.
65
-
2.**PackagePath**: final path within the package.
65
+
2.**PackagePath**: final path within the package. Can be a directory path ending in `\` and in that case the item's *RelativeDir*, *Filename* and *Extension* will be appended automatically. Linked files are also supported automatically.
66
66
67
67
If the item does **not** provide a *PackagePath*, and *Pack* is not *false*, the inference targets wil try to determine the right value, based on the following additional metadata:
68
68
@@ -136,7 +136,7 @@ This even works transitively, so if you use *PrivateAssets=all* on package refer
136
136
137
137
As usual, you can change this default behavior by using `Pack=false` metadata.
138
138
139
-
### Project References
139
+
### ProjectReference
140
140
141
141
Unlike SDK Pack that [considers project references as package references by default](https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#project-to-project-references), NuGetizer has an explicit contract between projects: the `GetPackageContents` target. This target is invoked when packing project references, and it returns whatever the referenced project exposes as package contents (including the inference rules above). If the project is *packable* (that is, it produces a package, denoted by the presence of a `PackageId` property), it will be packed as a dependency/package reference instead.
142
142
@@ -181,6 +181,8 @@ Package: Sample.1.0.0.nupkg
181
181
sample.pdb
182
182
```
183
183
184
+
Finally, you can focedly turn a project reference build output into a private asset even if it defines a `PackageId` by adding `PrivateAssets=all`. This is very useful for build and analyzer packages, which typically reference the main library project too, but need its output as private, since neither can use dependencies at run-time.
185
+
184
186
### dotnet-nugetize
185
187
186
188
Carefully tweaking your packages until they look exactly the way you want them should not be a tedious and slow process. Even requiring your project to be built between changes can be costly and reduce the speed at which you can iterate on the packaging aspects of the project. Also, generating the final `.nupkg`, opening it in a tool and inspecting its content, is also not ideal for rapid iteration.
Copy file name to clipboardExpand all lines: src/Directory.Build.targets
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@
32
32
<MakeDirDirectories="$(PackageOutputPath)"Condition="'$(PackageOutputPath)' != '' And !Exists('$(PackageOutputPath)')" />
33
33
</Target>
34
34
35
-
<TargetName="UpdatePackageMetadata"BeforeTargets="PrepareForBuild;GetAssemblyVersion;GenerateNuspec;Pack"Condition="$(IsPackable) And '$(RepositoryUrl)' != '' And '$(SourceRevisionId)' != ''">
35
+
<TargetName="UpdatePackageMetadata"BeforeTargets="PrepareForBuild;GetAssemblyVersion;GetPackageMetadata;GenerateNuspec;Pack"Condition="$(IsPackable) And '$(RepositoryUrl)' != '' And '$(SourceRevisionId)' != ''">
Text="Some project references cannot be properly packaged. Please install the NuGetizer package on the following projects: @(_NonNuGetizedProjectReference)." />
98
+
Code="NG0011"
99
+
Text="Some project references cannot be properly packaged. Please install the NuGetizer package on the following projects: @(_NonNuGetizedProjectReference)." />
99
100
100
101
<!--
101
102
PackageId metadata on all PackageFile items means we can tell appart which ones came from which dependencies
@@ -107,30 +108,36 @@ Copyright (c) .NET Foundation. All rights reserved.
0 commit comments