Is it possible to run a pre-release version of the DotNetCoreCLI task when writing an Azure Pipelines yaml script? I would like to use 3.0.1xx if possible to take advantage of dotnet tool update installing the tool rather than throwing an error if not installed.
If it is possible, what would the syntax be to make a call like this use a prerelease version rather than version 2:
- task: DotNetCoreCLI#2
continueOnError: true
inputs:
command: custom
custom: tool
arguments: install -g coverlet.console
displayName: Install Coverlet tool. This task will continue on error if coverlet is already installed.
you could use the following:
steps:
- task: UseDotNet#2
displayName: 'Use .NET Core sdk'
inputs:
packageType: sdk
version: 3.0.101
installationPath: $(Agent.ToolsDirectory)/dotnet
possible versions: https://github.com/dotnet/core/blob/master/release-notes/releases-index.json
reading: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/tool/dotnet-core-tool-installer?view=azure-devops
Related
After the latest .Net Maui update, my iOS app will longer build using the macos-12 image. Does anyone know how to specify an older version of .Net Maui using the CmdLine#2 Task? Here is what my current Task looks like.
- task: CmdLine#2
displayName: 'Install Maui'
inputs:
script: 'dotnet workload install maui'
The new version of .Net Maui seems to be looking for Xcode 14.1 and the iOS 16.1 SDK because it's using microsoft.net.sdk.ios version 16.1.1481.
I'm trying to figure out what version to use and this is getting ridiculous. You would think that I could specify one of these versions, but that's simply not the case. This is so frustrating and makes no sense!!!
https://github.com/dotnet/maui/releases
You would think that something like this would work.
- task: CmdLine#2
displayName: 'Install Maui'
inputs:
script: 'dotnet workload install --sdk-version 7.0.1xx maui'
https://maui.blob.core.windows.net/metadata/rollbacks/7.0.1xx.json
This seems to suggest that the version of Asp.net determines the .Net Maui version.
https://learn.microsoft.com/en-us/answers/questions/947953/how-do-i-get-net-maui-service-releases.html
Maui version will be determined by .net version.
AzureDevOps Pipleline force Task to install a certain version / old version of .Net Maui
To install a certain version of .net Maui in Azure Pipeline, you can use the Use dotnet v2 task to set the .net version of the pipeline. Then it will install a certain version of Maui.
Here is an example:
steps:
- task: UseDotNet#2
displayName: 'Use .NET Core sdk 7.0.100'
inputs:
version: 7.0.100
- script: 'dotnet workload install maui'
displayName: 'Command Line Script'
Here is how I was able to install an old version of .Net Maui.
I told the Pipeline to use Version 7.0.100 of Asp.net.
- task: UseDotNet#2
displayName: .NET Version
inputs:
packageType: 'sdk'
version: '7.0.100'
I told the Pipeline to use the 7.0.1xx Release version of .Net Maui.
https://github.com/dotnet/maui/tree/release/7.0.1xx
- task: CmdLine#2
displayName: 'Install Maui'
inputs:
script: 'dotnet workload install maui --from-rollback-file https://maui.blob.core.windows.net/metadata/rollbacks/7.0.1xx.json --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json --source https://api.nuget.org/v3/index.json'
Following this code:
https://learn.microsoft.com/en-us/azure/azure-functions/functions-how-to-azure-devops?tabs=csharp%2Cwindows
the Build pipeline fail on the "script" task with this error
enter image description here
If I replace this:
- task: DotNetCoreCLI#2
inputs:
command: publish
arguments: '--configuration Release --output publish_output'
projects: '*.csproj'
publishWebProjects: false
modifyOutputPath: false
zipAfterPublish: false
with this:
task: VSBuild#1
inputs:
solution: '***.sln'
msbuildArgs: '/p:OutDir=$(System.DefaultWorkingDirectory)/publish_output'
the build work but I need to publish
The project is built with Visual studio 2019 template for azure function. I did add an extra project to separate the logic, but it's all core 3.1. any suggestions?
According to your screen shot :( the build is using .NET Core 2.2.401, which has already reached end of life and is not .NET Core 3.1 as you expect.
You need to add a UseDotNet task to install the required .NET core release. Recommendation is that you have a global.json file for the version you expect.
- task: UseDotNet#2
displayName: 'Use .NET Core SDK (global.json)'
inputs:
packageType: 'sdk'
useGlobalJson: true
For useGlobalJson: false you can specifiy the version which should be used explicitly.
I am trying to build and deploy an Azure Function using Devops Pipeline (CI)
These are my steps
But everything till step Publish executing without any error. But at the Publish level I am getting this error (As in the image above)
Active code page: 65001
Info: .NET Core SDK/runtime 2.2 and 3.0 are now End of Life(EOL) and have been removed from all hosted agents. If you're using these SDK/runtimes on hosted agents, kindly upgrade to newer versions which are not EOL, or else use UseDotNet task to install the required version.
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://learn.microsoft.com/en-us/dotnet/core/tools/ and https://learn.microsoft.com/en-us/dotnet/core/compatibility/ . To learn about more such changes and troubleshoot, refer here: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting
##[error]Project file(s) matching the specified pattern were not found.
Finishing: Publish
I thought its because of .Net version thats why I have added Use .NET 5.x step just before publish. But it still triggering the same error.
Here is the Yaml of these 3 steps
steps:
- task: DotNetCoreCLI#2 displayName: 'dotnet build' inputs:
projects: 'Toolset/ScheduledJobs/*.csproj'
steps:
- task: UseDotNet#2 displayName: 'Use .NET Core sdk 5.x' inputs:
version: 5.x
steps:
- task: DotNetCoreCLI#2 displayName: Publish inputs:
command: publish
publishWebProjects: false
projects: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingdirectory)/ScheduledJobs'
zipAfterPublish: false
modifyOutputPath: false
Please let me know what I did wrong there?
I developed the Azure Function (3.0) in VS 2019
When you publish you need provide path to the project like here:
- task: DotNetCoreCLI#2
inputs:
command: 'publish'
publishWebProjects: true
projects: 'BlazorSample.csproj'
arguments: '--configuration $(buildConfiguration) --output $(build.artifactstagingdirectory)"'
zipAfterPublish: false
workingDirectory: $(Build.SourcesDirectory)/stackoverflow/51-blazor-sample/BlazorSample
Please notice working directory at the end.
Also change your order bu putting
- task: UseDotNet#2 displayName: 'Use .NET Core sdk 5.x' inputs:
version: 5.x
before this:
- task: DotNetCoreCLI#2 displayName: 'dotnet build' inputs:
projects: 'Toolset/ScheduledJobs/*.csproj'
I have a step in a simple yaml pipeline to install the Azure Sign Tool.
It installs it here but I do not have access /home/vsts/work/1/s.
Is there any way I can install the Azure Sign Tool to my local.
Maybe add a local path variable EF_BUILD_REPOSITORY_LOCAL and set it to my C:\temp folder?? Would that work?
- task: DotNetCoreCLI#2
inputs:
command: 'custom'
custom: 'tool'
arguments: 'install azuresigntool --tool-path $($env:EF_BUILD_REPOSITORY_LOCALPATH) -v diag'
displayName: Install AzureSignTool
I suppose you install the tool in order to use it in the subsequent steps of the pipeline. In this case, you can try installing it globally:
dotnet tool install --global AzureSignTool
In this case, you don't have to specify the tool path, and you can use it by specifying just the name later:
AzureSignTool sign ...
You can try like as the following steps.
steps:
- task: UseDotNet#2
displayName: 'Use .NET Core sdk'
inputs:
packageType: 'sdk'
- task: DotNetCoreCLI#2
displayName: 'Install AzureSignTool'
inputs:
command: custom
custom: tool
arguments: 'install -g azuresigntool -v diag'
In addition, it seems that Azure Sign Tool is only supported on Windows. We could install the tool on Linux or macOS, but not use it.
I am having an issue with Azure Pipelines. I am trying to build an ASP.NET Core 3.0 project. Yes, I know it's not supported yet, but other questions say you can do it by including the following in the pipeline script. I am not sure how to do that, however.
task: DotNetCoreInstaller#0
displayName: 'Install .net core 3.0 (preview)'
inputs: version: '3.0.100-preview6-012264'
Do I paste the above in the following script? If not, where would I place it? Also, I am on Preview 9 at present—is that supported yet?
# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://learn.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
variables:
buildConfiguration: 'Release'
steps:
- script: dotnet build --configuration $(buildConfiguration)
displayName: 'dotnet build $(buildConfiguration)'
Do I paste the following in the below script or where would i place it
You can paste following scripts at begin of Steps, like:
steps:
- task: UseDotNet#2
displayName: 'Use .NET Core sdk 3.0.100-preview9-014004'
inputs:
version: '3.0.100-preview9-014004'
includePreviewVersions: true
- task: dotnet build --configuration $(buildConfiguration)
displayName: 'dotnet build $(buildConfiguration)'
...
You can get it by searching use .net core in the search box:
I am on preview 9 at present does that support it yet
The answer is yes. This task is used to install the .NET SDK, which supports the .NET core 3.0 preview versions list.
As test result:
Hope this helps.
You probably want to use the UseDotNet#2 task. You can add it to your list of steps.
Here's an example...
- steps:
- task: UseDotNet#2
displayName: 'Use .NET Core sdk'
inputs:
packageType: sdk
version: 3.x
includePreviewVersions: true
installationPath: $(Agent.ToolsDirectory)/dotnet
- script: ... etc etc
displayName: Continue as normal, now that the .net core 3.x SDK is installed.
And yes, preview9 is supported. So is rc1. This step installs the latest 3.x version and includes all previews. Once it's released, you can remove the includePreviewVersions field if you want.
For more info, the docs are here: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/tool/dotnet-core-tool-installer?view=azure-devops