azure-functions-templates icon indicating copy to clipboard operation
azure-functions-templates copied to clipboard

getTools.ps1 fails in PowerShell Core

Open MisinformedDNA opened this issue 6 years ago • 0 comments

I ran getTools.ps1 in PowerShell Core (on Windows) and got the following error message:

C:\Repos\azure-functions-templates> .\getTools.ps1
add-type : (3,44): error CS0246: The type or namespace name 'ICertificatePolicy' could not be found (are you missing a using directive or an assembly reference?)
        public class TrustAllCertsPolicy : ICertificatePolicy {
                                           ^
At C:\Repos\azure-functions-templates\getTools.ps1:18 char:9
+         add-type @"
+         ~~~~~~~~~~~
+ CategoryInfo          : InvalidData: ((3,44): error CS024\u2026ssembly reference?):CSDiagnostic) [Add-Type], Exception
+ FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand

Download failed for https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-dev-win-x86.latest.zip

Message        : Cannot add type. Compilation errors occurred.
Data           : {}
InnerException :
TargetSite     : Void ThrowTerminatingError(System.Management.Automation.ErrorRecord)
StackTrace     :    at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
HelpLink       :
Source         : System.Management.Automation
HResult        : -2146233079

We should notify users of why it failed.

if ($PSVersionTable.PSVersion.Major -ge 6)
{
    Write-Host "PowerShell Core in not yet supported. Please use Windows PowerShell instead."
}

We may also want to update the README.md to specify that only Windows PowerShell is supported... at least until #820 is completed.

MisinformedDNA avatar Jun 29 '19 12:06 MisinformedDNA