Skip to content
This repository was archived by the owner on Aug 3, 2024. It is now read-only.

Commit 423d1c4

Browse files
authored
Preferring build environment's dotnet.exe to our own. (#409)
1 parent 2e29011 commit 423d1c4

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

build/common.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@ $DefaultConfiguration = 'debug'
44
$NuGetClientRoot = Split-Path -Path $PSScriptRoot -Parent
55
$CLIRoot = Join-Path $NuGetClientRoot 'cli'
66
$PrivateRoot = Join-Path $PSScriptRoot "private"
7-
$DotNetExe = Join-Path $CLIRoot 'dotnet.exe'
7+
$DotNetExeCommand = Get-Command dotnet.exe -ErrorAction Continue
8+
if ($DotNetExeCommand) {
9+
# prefer dotnet.exe present in build environment
10+
$DotNetExe = $DotNetExeCommand.Source
11+
}
12+
else {
13+
$DotNetExe = Join-Path $CLIRoot 'dotnet.exe'
14+
}
815
$NuGetExe = Join-Path $NuGetClientRoot '.nuget\nuget.exe'
916
$7zipExe = Join-Path $NuGetClientRoot 'tools\7zip\7za.exe'
1017
$BuiltInVsWhereExe = "${Env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"

0 commit comments

Comments
 (0)