My Azure Devops build has started failing with the following message in the log
Starting: Use .NET Core sdk
==============================================================================
Task : Use .NET Core
Description : Acquires a specific version of the .NET Core SDK from the internet or the local cache and adds it to the PATH. Use this task to change the version of .NET Core used in subsequent tasks. Additionally provides proxy support.
Version : 2.165.0
Author : Microsoft Corporation
Help : https://aka.ms/AA4xgy0
==============================================================================
Tool to install: .NET Core sdk version 3.x.
##[error]Failed to download or parse release-index.json with error: {}
Finishing: Use .NET Core sdk
The YAML contains
steps:
- task: UseDotNet#2
displayName: 'Use .NET Core sdk'
inputs:
packageType: 'sdk'
version: 3.x
the image is windows-2019
I ran the pipeline again some time later and it worked.
I had enabled diagnostics. Not sure if that helped.
Related
Fails to install workloads for MAUI for .NET 7 when running in azure dev ops. I was running the same pipeline in .NET 6 and it worked fine, but when I updated to .NET 7, it started failing to install the MAUI workload.
YAML
- task: UseDotNet#2
displayName: 'Use .NET Core sdk 7.x'
inputs:
version: 7.x
- task: DotNetCoreCLI#2
displayName: 'dotnet workload'
inputs:
command: custom
custom: 'workload '
arguments: 'install maui'
Logs
Installing pack Microsoft.Maui.Core.Ref.android version 7.0.0-rc.1.6430...
Workload installation failed. Rolling back installed packs...
Rolling back pack Microsoft.Maui.Core.Ref.android installation...
Workload installation failed: Unable to load the service index for source https://nuget.telerik.com/v3/index.json.
##[debug]Exit code 1 received from tool 'C:\hostedtoolcache\windows\dotnet\dotnet.exe'
##[debug]STDIO streams have closed for tool 'C:\hostedtoolcache\windows\dotnet\dotnet.exe'
##[error]Error: The process 'C:\hostedtoolcache\windows\dotnet\dotnet.exe' failed with exit code 1
##[debug]Processed: ##vso[task.issue type=error;]Error: The process 'C:\hostedtoolcache\windows\dotnet\dotnet.exe' failed with exit code 1
Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting
##[debug]task result: Failed
##[error]Dotnet command failed with non-zero exit code on the following projects :
##[debug]Processed: ##vso[task.issue type=error;]Dotnet command failed with non-zero exit code on the following projects :
##[debug]Processed: ##vso[task.complete result=Failed;]Dotnet command failed with non-zero exit code on the following projects :
Finishing: dotnet workload
Comments
It is strange that is trying to install the MAUI workload 7.0.0-rc.1.6430 even though I am using the latest .NET 7 and not the release candidate.
This exact pipeline was working with .NET 6
I was able to fix this by specifying the --source on the command. I think me having external nuget sources for private feeds was interfering with it selecting the correct workload version somehow.
- task: DotNetCoreCLI#2
displayName: 'dotnet workload'
inputs:
command: custom
custom: 'workload '
arguments: 'install maui --source https://api.nuget.org/v3/index.json'
Installing pack Microsoft.Maui.Core.Ref.android version 7.0.0-rc.1.6430..
When you run the dotnet workload install maui, it will install maui according to the .net SDK version specified in global.json file firstly.
When you have a global.json file in your project, it will keep the version specified in the file even if you install the latest .NET 7 in the Pipeline.
To solve this issue, you can modify the global.json file and define the .net version(7.0.100).
For example:
{
"sdk": {
"allowPrerelease": true,
"rollForward": "disable",
"version": "7.0.100"
}
}
You can disable the rollForward in global.json file. Then it will not automatically upgrade the dotnet version of the project.
When you run the pipeline with the global.json above, it will use the version: Microsoft.Maui.Core.Ref.android version 7.0.49. This is the latest version of Maui.
Result:
I am using azure devops on prem (previously called TFS). And I have a problem with build agent. When the agent is trying to download the latest microsoft .net core SDK it fails with self signed certificate in certificate chain error.
Here is the full error:
Starting: Use version 6.0.x of nuget
==============================================================================
Task : Use .NET Core
Description : Acquires a specific version of the .NET Core SDK from the internet or the local cache and adds it to the PATH. Use this task to change the version of .NET Core used in subsequent tasks. Additionally provides proxy support.
Version : 2.184.0
Author : Microsoft Corporation
Help : https://aka.ms/AA4xgy0
==============================================================================
Tool to install: .NET Core sdk version 6.0.x.
Found version 6.0.401 in channel 6.0 for user specified version spec: 6.0.x
Version 6.0.401 was not found in cache.
Getting URL to download .NET Core sdk version: 6.0.401.
Detecting OS platform to find correct download package for the OS.
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "& 'C:\AzureDevops\agent\_work\_tasks\UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6\2.184.0\externals\get-os-platform.ps1'"
Primary:win-x64
Detected platform (Primary): win-x64
Downloading: https://download.visualstudio.microsoft.com/download/pr/aa0b6cf3-c5dc-40ff-8b2f-f2970ca7b9e3/5b4a9999ea41ca5897e01a3e0e1accad/dotnet-sdk-6.0.401-win-x64.zip
##[error]Failed while installing version: 6.0.401 at path: C:\AzureDevops\agent\_work\_tool/dotnet with error: Could not download installation package from this URL: https://download.visualstudio.microsoft.com/download/pr/aa0b6cf3-c5dc-40ff-8b2f-f2970ca7b9e3/5b4a9999ea41ca5897e01a3e0e1accad/dotnet-sdk-6.0.401-win-x64.zip Error: Error: self signed certificate in certificate chain
Finishing: Use version 6.0.x of nuget
I had a look on agent code on github and I think problem is in this method:
I coudn't dig deeper in the projec itself but I think it is using this azure-pipelines-tool-lib/tool
But I coudn't find anything that would help me there either.
Any suggestions or configurations to check?
My workaround so far is to download the sdk manually and place it into cache folder (agent_work_tool\dotnet\sdk) of the agent, but I would have to do that every time microsoft releases new major version.
I have a build pipeline in Azure DevOps which has the following tasks and uses a hosted agent.
Now, when I run it the Test task fails with the following message.
Testhost process exited with error: It was not possible to find any compatible framework version
The framework 'Microsoft.AspNetCore.App', version '2.2.0' was not found.
How can I install version 2.2.0 in the hosted agent?
You can add a “Use .NET Core” task and specify version of .NET Core SDK or runtime to install. Here is a sample:
- task: UseDotNet#2
displayName: 'Use .NET Core runtime 2.2.0'
inputs:
packageType: runtime
version: 2.2.0
In addition,we have deprecated .NET Core 2.2 on 19 June for Windows, Ubuntu and macOS images. This change is because 2.2 version of .NET Core has been deprecated in January, 2020. As we try only to keep the versions which are not End Of Line (2.1, 3.0 and 3.1). You can find more detailed information in this ticket: https://github.com/actions/virtual-environments/issues/975 .
This is the error I get:
This is my configuration:
Can anyone help me?
I fix that for the latest .NET release.
The issue can be fixed with this line of code in your pipeline (.yaml) file.
steps:
- task: UseDotNet#2
displayName: 'Use .NET Core sdk 6.0.x'
inputs:
version: 6.x
includePreviewVersions: true
Just add the above step to your YAML file.
When you set the .NET Core SDK version to 3.x, it automatically download and install the latest in major version SDK 3.1.401, but SDK 3.1.401 is included in
Visual Studio 16.7.1. Since the hosted agent installed Visual Studio 16.6.30320.27, which doesn't include SDK 3.1.401, you would get the error during the build.
Currently, you could set the .NET Core SDK version to 3.1.302, or 3.1.107, which should solve your issue.
https://dotnet.microsoft.com/download/dotnet-core/3.1
This issue has been reported to product team in the following case, you can follow the case to track the status:
https://developercommunity.visualstudio.com/content/problem/1145815/net-coremsbuild-tooling-not-finding-right-version.html
I am trying to deploy a .netcore 2.1.5 api to Windows 2012 Server R2
Currently my published api site gives the following error when I navigate to it
HTTP Error 502.5 - Process Failure
Common causes of this issue:
The application process failed to start
The application process started but then stopped
The application process started but failed to listen on the configured port
Troubleshooting steps:
Check the system event log for error messages
Enable logging the application process' stdout messages
Attach a debugger to the application process and inspect
For more information visit: https://go.microsoft.com/fwlink/?LinkID=808681
In the event log I can see
Event 1000, IIS AspNetCore Module
Application 'MACHINE/WEBROOT/APPHOST/MYSITE.COM.AU/MYAPINAME' with physical root 'C:\WebSites\MYSITE.COM.AU\MyApps\MYAPINAME\' failed to start process
commandline '.\dotnet .\mydllname.dll', ErrorCode='0x80004005 : 80008083
From this question
I see that I can include
<PublishWithAspNetCoreTargetManifest>False</PublishWithAspNetCoreTargetManifest>
In the publish profile If I want to ensure the correct version of DotNetCore gets installed on the host computer.
But how do I set that up if I want to use Azure Devops?
I tried checking Publish Web Projects in the Publish task
but I then get an error
No web project was found in the repository. Web projects are identified by
presence of either a web.config file or wwwroot folder in the directory.
Project file(s) matching the specified pattern were not found.
The dependencies include
Microsoft.AspNetCore.App 2.1.5
but I don't see a coresponding dll deployed.
I tried installing dotnet-runtime-2.1.5 on the computer, downloaded from
the installer site
[Update]
I noticed the logs folder was missing so I created it manually
[Update]
I added the task suggested by Eriawan
The YAML is
steps:
- task: DotNetCoreInstaller#0
displayName: 'Use .NET Core sdk 2.1.5'
inputs:
version: 2.1.5
I get in the log
2018-10-29T08:29:05.4839748Z ##[section]Starting: Use .NET Core sdk 2.1.5
2018-10-29T08:29:05.4843909Z ==============================================================================
2018-10-29T08:29:05.4843981Z Task : .NET Core Tool Installer
2018-10-29T08:29:05.4844041Z Description : Acquires a specific version of .NET Core from internet or the tools cache and adds it to the PATH. Use this task to change the version of .NET Core used in subsequent tasks.
2018-10-29T08:29:05.4844089Z Version : 0.1.16
2018-10-29T08:29:05.4844134Z Author : Microsoft Corporation
2018-10-29T08:29:05.4844192Z Help : [More Information](https://go.microsoft.com/fwlink/?linkid=853651)
2018-10-29T08:29:05.4844234Z ==============================================================================
2018-10-29T08:29:05.9812262Z Tool to install: .NET Core sdk version 2.1.5.
2018-10-29T08:29:05.9825645Z Checking if a cached copy exists for this version...
2018-10-29T08:29:05.9830151Z Cache does not contains this particular .NET Core. Will be downloaded and installed.
2018-10-29T08:29:05.9833458Z Detected platform (Primary): win-x64
2018-10-29T08:29:05.9833723Z Getting URL to download .NET Core sdk version: 2.1.5.
2018-10-29T08:29:06.5248134Z Could not fetch download information for version 2.1.5. Please check if the version specified is correct. You can refer the link for supported versions => https://github.com/dotnet/core/blob/master/release-notes/releases.json. Falling back to creating convention based URL.
2018-10-29T08:29:06.5481883Z [command]C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "& 'D:\a\_tasks\DotNetCoreInstaller_b0ce7256-7898-45d3-9cb5-176b752bfea6\0.1.16\externals\install-dotnet.ps1' -Version 2.1.5 -DryRun"
2018-10-29T08:29:07.6386710Z dotnet-install: Payload URLs:
2018-10-29T08:29:07.6387117Z dotnet-install: Primary - https://dotnetcli.azureedge.net/dotnet/Sdk/2.1.5/dotnet-sdk-2.1.5-win-x64.zip
2018-10-29T08:29:07.6387245Z dotnet-install: Legacy - https://dotnetcli.azureedge.net/dotnet/Sdk/2.1.5/dotnet-dev-win-x64.2.1.5.zip
2018-10-29T08:29:07.6387445Z dotnet-install: Repeatable invocation: .\install-dotnet.ps1 -Version 2.1.5 -Channel LTS -Architecture x64 -InstallDir <auto>
2018-10-29T08:29:07.6451802Z Downloading: https://dotnetcli.azureedge.net/dotnet/Sdk/2.1.5/dotnet-sdk-2.1.5-win-x64.zip
2018-10-29T08:29:08.8792388Z ##[warning]Could not download installation package from this URL: https://dotnetcli.azureedge.net/dotnet/Sdk/2.1.5/dotnet-sdk-2.1.5-win-x64.zip Error: {}
2018-10-29T08:29:08.8807163Z Downloading: https://dotnetcli.azureedge.net/dotnet/Sdk/2.1.5/dotnet-dev-win-x64.2.1.5.zip
2018-10-29T08:29:09.5450400Z ##[warning]Could not download installation package from this URL: https://dotnetcli.azureedge.net/dotnet/Sdk/2.1.5/dotnet-dev-win-x64.2.1.5.zip Error: {}
2018-10-29T08:29:09.5453128Z ##[error]Failed to download package for installation
2018-10-29T08:29:09.5551776Z ##[section]Finishing: Use .NET Core sdk 2.1.5
The designer shows
The csproj is
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<ApplicationIcon />
<OutputType>Exe</OutputType>
<StartupObject />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>bin\Debug\netcoreapp2.1\trackApi.xml</DocumentationFile>
<DefineConstants>TRACE;DEBUG;NETCOREAPP2_1</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DocumentationFile>bin\Release\netcoreapp2.1\trackApi.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Folder Include="logs\" />
<Folder Include="Views\Account\" />
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.3" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.5" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.5" />
<PackageReference Include="Serilog.Extensions.Logging" Version="2.0.2" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageReference Include="Serilog.Sinks.RollingFile" Version="3.3.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="3.0.0" />
</ItemGroup>
<ItemGroup>
<Content Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>
[Update]
problems in build pipeline
[Update]
I created a new pipeline using YAML
pool:
vmImage: 'VS2017-Win2016'
variables:
buildConfiguration: 'Debug'
steps:
- task: DotNetCoreInstaller#0
displayName: 'Use .NET Core sdk 2.1.5'
inputs:
version: 2.1.5
- task: DotNetCoreCLI#2
displayName: Restore
inputs:
command: restore
projects: '**/Api*.csproj'
However I still get an error
018-10-29T09:36:13.7155347Z ##[section]Starting: Use .NET Core sdk 2.1.5
2018-10-29T09:36:13.7158688Z ==============================================================================
2018-10-29T09:36:13.7158742Z Task : .NET Core Tool Installer
2018-10-29T09:36:13.7158774Z Description : Acquires a specific version of .NET Core from internet or the tools cache and adds it to the PATH. Use this task to change the version of .NET Core used in subsequent tasks.
2018-10-29T09:36:13.7158842Z Version : 0.1.16
2018-10-29T09:36:13.7158878Z Author : Microsoft Corporation
2018-10-29T09:36:13.7158926Z Help : [More Information](https://go.microsoft.com/fwlink/?linkid=853651)
2018-10-29T09:36:13.7158958Z ==============================================================================
2018-10-29T09:36:14.1220877Z Tool to install: .NET Core sdk version 2.1.5.
2018-10-29T09:36:14.1231419Z Checking if a cached copy exists for this version...
2018-10-29T09:36:14.1238258Z Cache does not contains this particular .NET Core. Will be downloaded and installed.
2018-10-29T09:36:14.1240864Z Detected platform (Primary): win-x64
2018-10-29T09:36:14.1240993Z Getting URL to download .NET Core sdk version: 2.1.5.
2018-10-29T09:36:14.5706519Z Could not fetch download information for version 2.1.5. Please check if the version specified is correct. You can refer the link for supported versions => https://github.com/dotnet/core/blob/master/release-notes/releases.json. Falling back to creating convention based URL.
2018-10-29T09:36:14.5957734Z [command]C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "& 'D:\a\_tasks\DotNetCoreInstaller_b0ce7256-7898-45d3-9cb5-176b752bfea6\0.1.16\externals\install-dotnet.ps1' -Version 2.1.5 -DryRun"
2018-10-29T09:36:15.3109409Z dotnet-install: Payload URLs:
2018-10-29T09:36:15.3109790Z dotnet-install: Primary - https://dotnetcli.azureedge.net/dotnet/Sdk/2.1.5/dotnet-sdk-2.1.5-win-x64.zip
2018-10-29T09:36:15.3109942Z dotnet-install: Legacy - https://dotnetcli.azureedge.net/dotnet/Sdk/2.1.5/dotnet-dev-win-x64.2.1.5.zip
2018-10-29T09:36:15.3110089Z dotnet-install: Repeatable invocation: .\install-dotnet.ps1 -Version 2.1.5 -Channel LTS -Architecture x64 -InstallDir <auto>
2018-10-29T09:36:15.3188675Z Downloading: https://dotnetcli.azureedge.net/dotnet/Sdk/2.1.5/dotnet-sdk-2.1.5-win-x64.zip
2018-10-29T09:36:16.5236693Z ##[warning]Could not download installation package from this URL: https://dotnetcli.azureedge.net/dotnet/Sdk/2.1.5/dotnet-sdk-2.1.5-win-x64.zip Error: {}
2018-10-29T09:36:16.5256084Z Downloading: https://dotnetcli.azureedge.net/dotnet/Sdk/2.1.5/dotnet-dev-win-x64.2.1.5.zip
2018-10-29T09:36:17.2185860Z ##[warning]Could not download installation package from this URL: https://dotnetcli.azureedge.net/dotnet/Sdk/2.1.5/dotnet-dev-win-x64.2.1.5.zip Error: {}
2018-10-29T09:36:17.2189408Z ##[error]Failed to download package for installation
2018-10-29T09:36:17.2271136Z ##[section]Finishing: Use .NET Core sdk 2.1.5
The url https://dotnetcli.azureedge.net/dotnet/Sdk/2.1.5/dotnet-dev-win-x64.2.1.5.zip shows an error
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<Code>BlobNotFound</Code>
<Message>
The specified blob does not exist. RequestId:7447502f-301e-00a8-516d-6f7cde000000 Time:2018-10-29T09:57:58.4200303Z
</Message>
</Error>
[Update]
Eriawan has the answer.
I needed to use a YAML pipeline and get the version here.
In order to control the build to use specific version of .NET Core runtime, you must tell the build agent to install the .NET Core SDK to use and also specify the SDK version to install before building your code.
If you use YAML on your Azure DevOps Pipelines build, you could run this task: DotNetCoreInstaller#0 and set the version of to 2.1.403 .
The task must be run before any tasks, preferably the first task to run.
For example:
- task: DotNetCoreInstaller#0
inputs:
version: '2.1.403'
If you're using the build definition designer, add the ".NET Core Tool Installer" task and specify the version that you want to use from there.
Please consult .NET Core build sample on MSFT docs:
https://learn.microsoft.com/en-us/azure/devops/pipelines/languages/dotnet-core?view=vsts&tabs=yaml#build-environment
UPDATE 1:
OK, I have seen your build error. Looks like the .NET Core installer task has wrong URL address for .NET Core SDK of 2.1.403.
You can use pure YAML instead. I will file a bug on the .NET Core installer task repo. In the meantime, please use a full YAML.
I already have one working YAML file, a sample of this is available on my own repo.
For example:
https://github.com/RXCommunica/rx-azuredevops-rest/blob/master/azuredevopsrest-ci-vs2017.yml
UPDATE 2:
I have added comments for your YAML. The .NET Core tool version on your YAML is incorrect. Update/change your yaml from the original:
- task: DotNetCoreInstaller#0
displayName: 'Use .NET Core sdk 2.1.5'
inputs:
version: 2.1.5
to:
- task: DotNetCoreInstaller#0
displayName: 'Use .NET Core sdk 2.1.5'
inputs:
version: 2.1.403
This is important, because version of .NET Core runtime is not equal to the version of the actual SDK tool version.
Please consult this doc for the tool version and the related runtime list of .NET Core 2.1:
https://www.microsoft.com/net/download/dotnet-core/2.1