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
[](https://github.com/kzu/nugetizer/actions?query=branch%3Amain+workflow%3Abuild+)
13
-
[](http://build.azdo.io/kzu/oss/44)
@@ -176,7 +175,7 @@ As usual, you can change this default behavior by using `Pack=false` metadata.
176
175
177
176
### ProjectReference
178
177
179
-
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.
178
+
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 or `IsPackable=true`, for compatibility with SDK Pack), it will be packed as a dependency/package reference instead.
180
179
181
180
This means that by default, things Just Work: if you reference a library with no `PackageId`, it becomes part of whatever output your main project produces (analyzer, tools, plain lib). The moment you decide you want to make it a package on its own, you add the required metadata properties to that project and it automatically becomes a dependency instead.
182
181
@@ -262,3 +261,58 @@ Authoring, testing and iterating with your nuget packages should be easy and str
262
261
c. Clean the NuGet HTTP cache: this avoids a subsequent restore from a test/sample project from getting an older version from there, in case you build locally the same version of a previously restored one from an HTTP source.
263
262
264
263
These cleanups only apply in local builds, never in CI, and you can turn them all off by setting `EnablePackCleanup=false`.
264
+
265
+
## Advanced Features
266
+
267
+
This section contains miscelaneous useful features that are typically used in advanced scenarios and
268
+
are not necessarily mainstream.
269
+
270
+
### Packing arbitrary files from referenced packages
271
+
272
+
If you want to pack files from referenced packages, you can simply add `PackageReference` attribute
273
+
to `PackageFile`. Say we want to resuse the awesome icon from the
274
+
[ThisAssembly](https://nuget.org/packages/ThisAssembly) package, we can just bring it in with:
<!-- If we're packing on build, just add Pack as a dependency for Build -->
242
+
<_IsInnerBuildCondition="'$(TargetFramework)' != '' and '$(TargetFrameworks)' != ''">true</_IsInnerBuild>
243
243
<_ShouldPackOnBuildCondition="'$(PackOnBuild)' == 'true' And '$(IsPackable)' == 'true'">true</_ShouldPackOnBuild>
244
-
<BuildDependsOnCondition="'$(NoBuild)' != 'true' And '$(_ShouldPackOnBuild)' == 'true'">
245
-
$(BuildDependsOn);
246
-
Pack;
247
-
</BuildDependsOn>
248
-
<!-- If we're not packing on build, set up a dependency from Pack>Build for non-NuProj that are packable, so Build runs before Pack -->
249
-
<PackDependsOnCondition="'$(NoBuild)' != 'true' And '$(IsPackagingProject)' != 'true' And '$(_ShouldPackOnBuild)' != 'true' And '$(IsPackable)' == 'true'">
Condition="'$(BuildOnPack)' != 'false' And '$(_IsInnerBuild)' != 'true' And '$(NoBuild)' != 'true' And '$(IsPackagingProject)' != 'true' And '$(_ShouldPackOnBuild)' != 'true' And '$(IsPackable)' == 'true'" />
<ErrorCondition="'@(FromPackageReference)' != '' and '%(FromPackageReference.PathValue)' == ''"
84
+
Code="NG0014"
85
+
Text="In order to reference content from package '%(FromPackageReference.Identity)', make sure its package reference specifies GeneratePathProperty='true'." />
Copy file name to clipboardExpand all lines: src/NuGetizer.Tasks/Resources.resx
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -121,12 +121,15 @@
121
121
<value>Package file '{0}' must have either 'PackFolder' or 'PackagePath' metadata.</value>
122
122
</data>
123
123
<dataname="ErrorCode_NG0011"xml:space="preserve">
124
-
<value>Project references to include in package must be nugetized.</value>
124
+
<value>Some project references cannot be properly packaged. Please install the NuGetizer package on the following projects: {0}.</value>
125
125
</data>
126
126
<dataname="ErrorCode_NG0012"xml:space="preserve">
127
127
<value>Duplicate package source files with distinct content detected. Duplicates are not allowed in the package. Please remove the conflict between these files: {0}</value>
128
128
</data>
129
129
<dataname="ErrorCode_NG0013"xml:space="preserve">
130
130
<value>Content files cannot specify the reserved 'contentFiles' relative directory. Please use the 'CodeLanguage' and 'TargetFramework' item metadata for '{0}' to control its relative path within 'contentFiles'.</value>
131
131
</data>
132
+
<dataname="ErrorCode_NG0014"xml:space="preserve">
133
+
<value>In order to reference content from package '{0}', make sure its package reference specifies GeneratePathProperty="true".</value>
0 commit comments