Problem statement:
I have specflow tests written in .NetCore and used to run on windows based agents. Now I need to run these tests in linux agent.
I have used build pipeline with windows based agent to build the artifacts. Then in the Release pipeline I have added the vstest Task and Ubuntu agent as below
Agent Pool: Azure Pipelines
Agent Specfication: Ubuntu 20.04
When I run the pipeline the vstest task gave error as below
This task is supported only on Windows agents and cannot be used on other platforms
How to resolve this issue?
There is a work around to achieve this.
Add dotnet test Task and change the command to 'custom' instead of test and custom command as 'vstest'. The configuration looks as below
steps:
- task: DotNetCoreCLI#2
displayName: 'dotnet custom'
inputs:
command: custom
projects: '**/Tests.dll'
custom: vstest
arguments: '--logger:trx;logfilename=TEST.xml'
timeoutInMinutes: 120
You can't use vstest on Linux. vstest requires that either Visual Studio is installed or that you have the VS Test Platform installed.
If you want to use vstest you can change the Agent Specification to Windows.
Related
I updated my VS build tools 2019 to 2022. Upgraded it for dotnet6. After I updated it to latest one, the pipelines build for dot net framework and dot net 5 failing and throwing error like below
##[error]No agent found in pool DotNet satisfies both of the following demands: Agent.Name, visualstudio. All demands: Agent.Name -equals , msbuild, visualstudio, Agent.Version -gtVersion 2.115.0
But the same pipelines working fine on VS Build tools 2019. We are using the Nuget and VS build in the tasks which are failing. For some pipelines which we are using .netcoreCLI, this build tools 22 are working for .netcoreCLI task. There are many pipelines where I can't migrate to .netcoreCLI. Please someone help me to sort out this issue. [
MSBuild or VSbuild task is not working after I updated it to Visual Studio Build tools 2022 from 2019
According to the error message, this shows that your pipeline has added demands, but there are no agents that meet the requirements in your agent pool:
##[error]No agent found in pool DotNet satisfies both of the following demands: Agent.Name, visualstudio.
So, please check if your pipeline have set any demands:
If you set it,please try to remove or you need to check the value for the capabilities of your agent:
I am working on a release pipeline that should deploy our project artifacts and run tests over them.
The agent is on a Ubuntu machine.
So far I couldn't find a way to run tests over Ubuntu because as microsoft docs say we should install either the Visual Studio or Visual Studio Test Platform using an installer task on the agent.
The problem is neither of them are available on a linux OS , so I am a bit stuck here wondering if there is a third option that we can use to run our tests on this agent.
It depends on what type of your project is. If your project is .net core, you can try dotnet core cli task. Dotnet test can cross OS. If your project is .net fx, it cannot run on linux.
Run dotnet test command in .Net Core task
If you are using deployment group , you can run dotnet test command in a bash task and then use a Publish Test Result task to retrun trx files that Test has generated.
I have got a Visual Studio 2019 Solution with a .NET Framework Application, with a Azure Pipeline that builds and deploys a web app.
I recently added an Azure Functions Project to my solution. (.net core)
The two projects in the solution do not refrence each other.
On my Local Machine - The solution builds with no problems, and I can run both applications.
However when the Azure Pipeline process tries to build the solution fails with the following error:
Error NETSDK1045: The current .NET SDK does not support targeting .NET
Core 3.1. Either target .NET Core 2.1 or lower, or use a version of
the .NET SDK that supports .NET Core 3.1.
I actually want this Azure Pipeline to ignore the new .net core project, and contiune to build then deploy my web application.
How can I get Azure to build my project in the same way as my local machine?
It looks like that the pipeline is trying to use the wrong .NET Core SDK to compile your projects which are targeting .NET Core 3.1.
You can try adding task Use .NET Core before restore and build task to make sure the .NET Core 3.1 version is used in your pipeline. See below:
- task: UseDotNet#2
inputs:
version: 3.1.302
- task: DotNetCoreCLI#2
inputs:
command: restore
projects: '**/*.csproj'
- task: DotNetCoreCLI#2
inputs:
command: build
projects: '**/*.csproj'
If you used Visual Studio Build task to build your projects, you need to run your pipeline on agent windows-latest which has visual studio 2019 installed. Or you might still encounter this error "The current .NET SDK does not support targeting .NET Core 3.1"
If you want to ignore the new .net core project. You can set the projects attribute of the build task to build a specific project. See below:
- task: DotNetCoreCLI#2
inputs:
command: restore
projects: '**/oldProject.csproj'
- task: DotNetCoreCLI#2
inputs:
command: build
projects: '**/oldProject.csproj'
Visual Studio Build task to build a single project
- task: VSBuild#1
condition: always()
inputs:
solution: '**/oldProject.csproj'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
msbuildArgs: '/t:build'
I had this problem, I had just updated a project from .NET Core 2.2 to .NET Core 3.1 and it stopped building in Azure Devops giving me the error The current .NET SDK does not support targeting .NET Core 3.1 during the Nuget Restore task.
The pipeline was using the Nuget Tool Installer task before the Nuget Restore. The installer was using a version of Nuget that didn't support .NET Core 3.1.
I updated the Nuget Tool Installer to use a newer version and my build ran correctly.
I am trying to use Jenkins to run my unittests. I have made a Jenkins Project for a build with a buildstep "Build a Visual Studio Project using MSBuild". My Jenkins server is installed on a linux vm which is in Azure.
You can see it here in the Jenkins UI:
When I run the build I get this Console Output:
Path To MSBuild.exe: msbuild.exe
FATAL: Unable to use this plugin on this kind of operation system
Executing the command msbuild.exe /ContinuousIntegration/ContinuousIntegration.sln from
/var/lib/jenkins/workspace/CSHARP_CI_TEST - UNITTEST
[CSHARP_CI_TEST - UNITTEST] $ msbuild.exe
/ContinuousIntegration/ContinuousIntegration.sln
Build step 'Build a Visual Studio project or solution using MSBuild' changed
build result to FAILURE
Build step 'Build a Visual Studio project or solution using MSBuild' marked
build as failure
Finished: FAILURE
I think the problem here is that I am trying to use msbuild.exe on a Linux VM. Is there a workaround for this or is it not possible to do this?
I have tried to use the msbuild.exe on the vm via a linux terminal, but it is not possible to run it.
To accomplish your requirement you have to install '.NET Core SDK' in the Azure Jenkins Linux VM and then you may simply use 'Execute shell' build step with the command 'dotnet build ContinuousIntegration/ContinuousIntegration.sln'
To install '.NET Core SDK' in your Azure Jenkins Linux VM, please go to https://dotnet.microsoft.com/learn/dotnet/hello-world-tutorial/install and click on 'Linux' in that page and then select the required Linux distribution and follow the steps provided.
For more information on MSBuild support on various operating systems, please refer https://github.com/Microsoft/msbuild/blob/master/documentation/wiki/Building-Testing-and-Debugging-on-.Net-Core-MSBuild.md
Just FYI, I have tested and reproduced your scenario and faced the same error which you have mentioned and then I have followed the above process and resolved the issue successfully. So I hope this helps. Cheers!!
PS: in your shell script you have to cd to the right folder for this to work.
I have an Application written with Xamarin and a buildpipline on Azure Devops. This builds fine when I target IOS 11.x. However I would like to update to SDK 12 since Apple starts to enforce this starting in march 2019:
SDK Version Issue - This app was built with the iOS 11.4 SDK. Starting
March 2019, all iOS apps submitted to the App Store must be built with
the iOS 12.1 SDK or later, included in Xcode 10.1 or later.
But when I build I always get this error in my Azure Devops pipeline:
MTOUCH : error MT0074: Xamarin.iOS 11.14.0 does not support a deployment target of 12.0 for iOS (the maximum is 11.4). Please select an older deployment target in your project's Info.plist or upgrade to a newer version of Xamarin.iOS.
Based on this article I tried to set the SDK Version with this script:
/bin/bash -c "sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh 5_12_0"
Unfortunately it still uses the 11 SDK instead of 12.
Did I choose the wrong Mono Version or is that the wrong approach to select the Xamarin.IOS SDK?
My complete build YAML for the IOS Job:
queue:
name: Hosted macOS
demands:
- xcode
- Xamarin.iOS
steps:
- bash: |
echo "Select Xamarin Version"
/bin/bash -c "sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh 5_12_0"
displayName: 'Select Xamarin Version'
- task: InstallAppleCertificate#2
displayName: 'Install an Apple certificate'
inputs:
certSecureFile: '6f1c094d-c147-41e0-9bc6-c9fe9a40b2e6'
certPwd: '$(P12password)'
- task: InstallAppleProvisioningProfile#1
displayName: 'Install an Apple provisioning profile'
inputs:
provProfileSecureFile: 'a883a983-6027-4382-afd4-94b52736323c'
- task: NuGetToolInstaller#0
displayName: 'Use NuGet'
inputs:
versionSpec: 4.x
- task: NuGetCommand#2
displayName: 'NuGet restore'
inputs:
restoreSolution: '$(Parameters.solution)'
- task: XamariniOS#2
displayName: 'Build Xamarin.iOS '
inputs:
solutionFile: Src/MoneyFox.Ios/MoneyFox.iOS.csproj
configuration: '$(BuildConfiguration)'
You should be able to select the correct version of Mono and Xcode now based on this documentation. In Azure DevOps in both the build and the release pipelines (before the Xamarin.iOS build task and the release task respectively), I added a command line task that runs the following:
echo 'Updating fastlane...'
sudo gem install fastlane
echo 'Selecting Mono version...'
/bin/bash -c "sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh 5_16_0"
echo 'Selecting Xcode version...'
/bin/bash -c "echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_10.1.app;sudo xcode-select --switch /Applications/Xcode_10.1.app/Contents/Developer"
In case it helps: the build SDK and the deployment target are different things. I'm building using the 12.1 SDK, but my deployment target, and minimum OS version, are both set to 8.0.
Check 'MinimumOSVersion' key in info.plist.
If it doesn't exist, add it.
<key>MinimumOSVersion</key>
<string>11.0</string>
This looks like a problem with availability of the right version of the Xamarin.iOS library (12.0 or higher) on the DevOps build machine. While it was according to my observations included with recent updates of VS 15.9 (for Windows), or potentially via the Tools for Xamarin extension (still not sure here completely how it gets to a local machine), the VS on the Azure DevOps build machine is 15.8 and comes with default Xamarin.iOS 11.
So the options here are really use your own build machine with or wait for 15.9 to [hopefully] come to the DevOps machines in time.