Skip to content

Commit 8df06d3

Browse files
authored
Follow Deterministic configuration when using NuGetPack (#16001)
1 parent 71b0f48 commit 8df06d3

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/Microsoft.DotNet.Build.Tasks.Packaging/src/NuGetPack.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ public string PackedPackageNamePrefix
132132
set;
133133
}
134134

135+
public bool Deterministic
136+
{
137+
get;
138+
set;
139+
}
140+
135141
public override bool Execute()
136142
{
137143
if (Nuspecs == null || Nuspecs.Length == 0)
@@ -254,7 +260,7 @@ public void Pack(string nuspecPath, string nupkgPath, Manifest manifest, bool pa
254260
bool creatingSymbolsPackage = packSymbols && (Path.GetExtension(nupkgPath) == _symbolsPackageExtension);
255261
try
256262
{
257-
PackageBuilder builder = new PackageBuilder();
263+
PackageBuilder builder = new PackageBuilder(deterministic: Deterministic);
258264

259265
string baseDirectoryPath = (string.IsNullOrEmpty(BaseDirectory)) ? Path.GetDirectoryName(nuspecPath) : BaseDirectory;
260266
builder.Populate(manifest.Metadata);

src/Microsoft.DotNet.Build.Tasks.Packaging/src/build/Packaging.targets

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,7 @@
12711271

12721272
<Message Condition="'$(_SkipCreatePackage)' == 'true'" Text="Skipping package creation for $(NuSpecPath) because the following files do not exist: @(_missingFiles)" />
12731273

1274-
<NugetPack Nuspecs="$(NuSpecPath)"
1274+
<NuGetPack Nuspecs="$(NuSpecPath)"
12751275
OutputDirectory="$(PackageOutputPath)"
12761276
ExcludeEmptyDirectories="true"
12771277
CreateSymbolPackage="true"
@@ -1282,6 +1282,7 @@
12821282
AdditionalLibPackageExcludes="@(AdditionalLibPackageExcludes)"
12831283
AdditionalSymbolPackageExcludes="@(AdditionalSymbolPackageExcludes)"
12841284
PackedPackageNamePrefix="$(PackedPackageNamePrefix)"
1285+
Deterministic="$(Deterministic)"
12851286
Condition="'$(_SkipCreatePackage)' != 'true'"/>
12861287

12871288
<!-- Create a marker that records the path to the generated package -->

0 commit comments

Comments
 (0)