Created
August 14, 2018 14:21
-
-
Save mjul/600f8f4706bedc8e5c066a4a94f13e71 to your computer and use it in GitHub Desktop.
Install the latest release of the Azure Functions item and project templates for dotnet new
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install the latest release of the Azure item and project templates: | |
# | |
# See [Azure Functions Templates wiki](https://github.com/Azure/azure-functions-templates/wiki/Using-the-templates-directly-via-dotnet-new) | |
# See [Issue 721](https://github.com/Azure/azure-functions-templates/issues/721) | |
$feed = Invoke-WebRequest https://functionscdn.azureedge.net/public/cli-feed-v3.json | ConvertFrom-Json | |
$release = $feed.tags.v2.release | |
foreach ($t in "itemTemplates", "projectTemplates") { | |
$uri = $feed.releases."$release"."$t" | |
$headers = Invoke-WebRequest $uri -Method Head | |
$name = $headers.Headers."Content-Disposition" -replace 'filename=(.*)', '$1' | |
Write-Output "Installing $name ..." | |
$tmpFile = [System.IO.Path]::GetTempFileName(); | |
Invoke-WebRequest $uri -OutFile $tmpFile | |
dotnet new -i $tmpFile | Out-Null | |
Remove-Item $tmpFile | |
} | |
# To uninstall: | |
# | |
# dotnet new -u Azure.Functions.Templates | |
# dotnet new -u Microsoft.AzureFunctions.ProjectTemplates |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment