Skip to content

Powershell Install Script Custom Path Error #29

@TheBrambleShark

Description

@TheBrambleShark

Hello,

When running the following command:

powershell -executionpolicy bypass .\dotnet-install.ps1 -InstallDir "C:\Program Files\dotnet" -Channel LTS

the following is output:

dotnet-install: Downloading link: https://dotnetcli.azureedge.net/dotnet/Sdk/Files\dotnet/dotnet-sdk-Files\dotnet-win-x64.zip
dotnet-install: Cannot download: https://dotnetcli.azureedge.net/dotnet/Sdk/Files\dotnet/dotnet-sdk-Files\dotnet-win-x64.zip
dotnet-install: Downloading legacy link: https://dotnetcli.azureedge.net/dotnet/Sdk/Files\dotnet/dotnet-dev-win-x64.Files\dotnet.zip
dotnet-install: Cannot download: https://dotnetcli.azureedge.net/dotnet/Sdk/Files\dotnet/dotnet-dev-win-x64.Files\dotnet.zip
powershell : Could not find/download: ".NET Core SDK" with version = Files\dotnet
At line:1 char:1
+ powershell -executionpolicy bypass .\dotnet-install.ps1 -InstallDir " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Could not find/... = Files\dotnet:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
Refer to: https://aka.ms/dotnet-os-lifecycle for information on .NET Core support
At C:\burn\dotnet-install.ps1:655 char:5
+     throw "Could not find/download: `"$assetName`" with version = $Sp ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Could not find/...ET Core support:String) [], RuntimeException
    + FullyQualifiedErrorId : Could not find/download: ".NET Core SDK" with version = Files\dotnet
Refer to: https://aka.ms/dotnet-os-lifecycle for information on .NET Core support

As you can see, the string concatenation somehow goes wrong, leading to /dotnet/Sdk/Files\dotnet/dotnet-sdk-Files... in the first file path.

System Information:
Windows 10 Professional 1909
Powershell environment: elevated PowerShell ISE (running as another user)

When no parameters are provided, the script runs exactly as expected, leading to the DotNet sdk installing under the user's profile. However, I instead want DotNet to install under C:\Program Files\dotnet so it is available to everyone.

Work-around: Installing with the .exe installer.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions