Skip to content

Commit ec55e21

Browse files
committed
Add dotnet nuget pack fallback when nuget.exe unavailable
1 parent a34ecb3 commit ec55e21

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

build/Build.BuildAndDeployTargets.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,14 @@ private string ExecuteDotnetToolPipeline(
221221
File.Delete(nupkgPath);
222222
}
223223

224-
InvokeProcess("nuget", new List<string> { "pack", nuspecPath, "-OutputDirectory", outputDirectory, "-NoPackageAnalysis" }, RepoRootPath, true);
224+
if (CommandExists("nuget"))
225+
{
226+
InvokeProcess("nuget", new List<string> { "pack", nuspecPath, "-OutputDirectory", outputDirectory, "-NoPackageAnalysis" }, RepoRootPath, true);
227+
}
228+
else
229+
{
230+
InvokeDotNet(new List<string> { "nuget", "pack", nuspecPath, "-OutputDirectory", outputDirectory, "-NoPackageAnalysis" }, RepoRootPath, true);
231+
}
225232

226233
if (installAfterPack)
227234
{
@@ -559,9 +566,9 @@ private DeploymentResult DeployDirectorCore()
559566
return CreateDeploymentResult("Director", "Skipped", "dotnet was not found in PATH.");
560567
}
561568

562-
if (!CommandExists("nuget"))
569+
if (!CommandExists("nuget") && !CommandExists("dotnet"))
563570
{
564-
return CreateDeploymentResult("Director", "Skipped", "nuget was not found in PATH.");
571+
return CreateDeploymentResult("Director", "Skipped", "nuget or dotnet nuget was not found in PATH.");
565572
}
566573

567574
var nupkgPath = ExecuteDotnetToolPipeline(
@@ -590,9 +597,9 @@ private DeploymentResult DeployWebUiCore()
590597
return CreateDeploymentResult("WebUi", "Skipped", "dotnet was not found in PATH.");
591598
}
592599

593-
if (!CommandExists("nuget"))
600+
if (!CommandExists("nuget") && !CommandExists("dotnet"))
594601
{
595-
return CreateDeploymentResult("WebUi", "Skipped", "nuget was not found in PATH.");
602+
return CreateDeploymentResult("WebUi", "Skipped", "nuget or dotnet nuget was not found in PATH.");
596603
}
597604

598605
var nupkgPath = ExecuteDotnetToolPipeline(

0 commit comments

Comments
 (0)