Files
runner-images-sangeeth/images/win/post-generation/Update-DotnetPath.ps1
Dibir Magomedsaygitov 85b60d074c resolve comments
2020-09-30 12:34:36 +03:00

22 lines
761 B
PowerShell

$latestPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine)
$dotnetPath = "$env:USERPROFILE\.dotnet\tools"
if ($latestPath.Contains("C:\Users\VssAdministrator\.dotnet\tools"))
{
$latestPath = $latestPath.Replace("C:\Users\VssAdministrator\.dotnet\tools", "$dotnetPath")
$isPathUpdated = $true
}
if (-not $latestPath.Contains($dotnetPath))
{
$latestPath = "$dotnetPath;$latestPath"
Write-Host "Added .dotnet\tools $dotnetPath to PATH"
$isPathUpdated = $true
}
else
{
Write-Host "$dotnetPath already in PATH"
}
$updatedPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine)
Write-Host "Windows PATH: $updatedPath"