diff --git a/PowerShellGitHubDev.psm1 b/PowerShellGitHubDev.psm1 index 483da716af..e8b6d82440 100644 --- a/PowerShellGitHubDev.psm1 +++ b/PowerShellGitHubDev.psm1 @@ -23,6 +23,7 @@ try { function Start-PSBuild { [CmdletBinding(DefaultParameterSetName='CoreCLR')] param( + [switch]$NoPath, [switch]$Restore, [Parameter(ParameterSetName='CoreCLR')] @@ -57,6 +58,15 @@ function Start-PSBuild { $FullCLR = $true } + if (-not $NoPath) { + Write-Verbose "Appending probable .NET CLI tool path" + if ($IsWindows) { + $env:Path += ";$env:LocalAppData\Microsoft\dotnet\cli" + } elseif ($IsOSX) { + $env:PATH += ":/usr/local/share/dotnet" + } + } + # verify we have all tools in place to do the build $precheck = precheck 'dotnet' "Build dependency 'dotnet' not found in PATH! See: https://dotnet.github.io/getting-started/" if ($FullCLR) { @@ -65,7 +75,8 @@ function Start-PSBuild { # msbuild is needed to build powershell.exe # msbuild is part of .NET Framework, we can try to get it from well-known location. - if (-not (Get-Command -Name msbuild -ErrorAction Ignore)) { + if (-nopt $NoPath -and -not (Get-Command -Name msbuild -ErrorAction Ignore)) { + Write-Verbose "Appending probable Visual C++ tools path" $env:path += ";${env:SystemRoot}\Microsoft.Net\Framework\v4.0.30319" } @@ -301,10 +312,11 @@ function Start-PSBootstrap { Remove-Item dotnet*.pkg wget https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-dev-osx-x64.latest.pkg sudo installer -pkg dotnet-dev-osx-x64.latest.pkg -target / + } elseif ($IsWindows -And -Not $IsCore) { Invoke-WebRequest -Uri https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/install.ps1 -OutFile install.ps1 ./install.ps1 - $env:Path += ";$env:LocalAppData\Microsoft\dotnet\cli" + } else { Write-Warning "Start-PSBootstrap cannot be run in Core PowerShell on Windows (need Invoke-WebRequest!)" } diff --git a/docs/building/osx.md b/docs/building/osx.md index 56c4c04a7a..e08ba59b88 100644 --- a/docs/building/osx.md +++ b/docs/building/osx.md @@ -19,6 +19,11 @@ The `Start-PSBootstrap` function does the following: - Uses `brew` to install CMake, OpenSSL, and GNU WGet - Downloads and installs the latest .NET CLI package +- Adds `/usr/local/share/dotnet` to the process path + +Please heed that last step. You may want to add the .NET CLI tool +location to your path more permanently by adding it to your shell's +profile. Build using our module ====================== diff --git a/docs/building/windows-core.md b/docs/building/windows-core.md index 288ef7a61c..33c73211d8 100644 --- a/docs/building/windows-core.md +++ b/docs/building/windows-core.md @@ -38,7 +38,6 @@ The `Start-PSBootstrap` function itself does exactly this: ```powershell Invoke-WebRequest -Uri https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/install.ps1 -OutFile install.ps1 ./install.ps1 -$env:Path += ";$env:LocalAppData\Microsoft\dotnet\cli" ``` If you have any problems installing `dotnet`, please see their