This repository has been archived. No new features are added, because .NET Core is included in Microsoft Update now. For more information see .NET Core coming to Microsoft Update.
Azure DevOps pipeline task that downloads and installs the latest .NET Core runtime and hosting bundle.
Starting in December 2020 .NET Core has been added to Microsoft Update. Before you proceed and use this custom extension, have a look at .NET Core coming to Microsoft Update.
- 2.1
- 2.2
- 3.0
- 3.1
- 5.0
- 6.0
# Install the .NET Core runtime and hosting bundle
- task: InstallNetCoreRuntimeAndHosting@1
inputs:
#version: '3.0' # Options: 2.1, 2.2, 3.0, 3.1, 5.0, 6.0
#useProxy: false
#proxyServerAddress: # Required when useProxy == true
#norestart: false
#iisReset: true
#installArguments: # Optional
Name | Description |
---|---|
version Version |
Version of .NET Core to download and install. Options: 2.1 , 2.2 , 3.0 , 3.1 , 5.0 , 6.0 |
useProxy Use a proxy server |
Enabling this option will make it possible to specify a proxy server address that will be used to download the installer. |
proxyServerAddress Proxy server address |
The URL of the proxy server to use when downloading the installer. Needs to include the port number. Example: http://proxy.example.com:80 |
norestart No Restart |
Enabling this option will pass the /norestart argument to the installer to suppress any attempts to restart. |
iisReset Perform IIS reset |
Enabling this option will reset IIS after installation. The reset is recommended for all changes to take effect. |
installArguments Install arguments |
Optional arguments that will be passed to the installer. Example: 'OPT_NO_ANCM=1 OPT_NO_X86=1' . See these options for more information. |
- Install the Install .NET Core Runtime & Hosting Bundle extension from the Marketplace in your Azure DevOps organization.
- Create a new Environment with the name 'net-core-test'. Select 'Virtual machines' as the resource type.
- Register a machine in the new Environment and give it the tag 'net-core'.
- Create a new YAML pipeline with the following content.
trigger: none
stages:
- stage: 'InstallNetCore'
jobs:
- deployment: 'InstallNetCore'
environment:
name: 'net-core-test'
resourceType: 'VirtualMachine'
tags: 'net-core'
strategy:
runOnce:
deploy:
steps:
- task: InstallNetCoreRuntimeAndHosting@1
inputs:
version: '3.1'
useProxy: false
norestart: false
iisReset: true
- Save and run the pipeline.
-
Install the Install .NET Core Runtime & Hosting Bundle extension from the Marketplace in your Azure DevOps organization.
-
Create a Deployment group.
-
Create a new Release pipeline.
-
Add a Deployment group job for the new Deployment group.
-
Add the
Install .NET Core Runtime & Hosting Bundle
task to the Deployment group job. -
Configure the version you want to install.
-
Save and run the pipeline.
The task wraps a PowerShell script that:
- Retrieves the latest available .NET Core version from the appropriate
releases.json
, like https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/3.0/releases.json. - Looks in the
releases.json
for the download URL of the .NET Core Runtime & Hosting bundle installer (dotnet-hosting-win.exe
). - Downloads the installer.
- Executes the installer.
- Uploads any logs created by the installer.
- Performs an IIS reset if specified.
The task does not use PowerShell remoting so it will download and install .NET Core on the server where the task is run.
No.
The .NET Core runtime and hosting bundle is only available for Windows.
In some cases you might get an error like the one below because the task is unable to download the installer.
Load release data from: https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/3.0/releases.json
Exception calling "DownloadString" with "1" argument(s): "The underlying connection was closed: An unexpected error occurred on a receive."
At C:\azagent\A1\_work\_temp\39753a3f-3f3e-4351-b612-3d286ccd9f29.ps1:20 char:5
+ $releases = $webClient.DownloadString($releasesJSONURL) | Convert ...
There are several reasons that might cause an error like this to occur:
- The site
https://dotnetcli.blob.core.windows.net
, with the releases.json that has the download URL for the installer, is not a trusted site. - The site
https://download.visualstudio.microsoft.com/
, where the installer is hosted, is not a trusted site. - The server does not have outgoing internet access.
Depending on the reason adding a site to the trusted sites might do the trick.
This task is open source on GitHub.