Azure Dev Ops test step not finding tests (.net 5) - azure-devops

I have a simple .net 5 project that contains a main project and a unit test project with nUnit3 tests. On my machine (a mac with visual studio for mac fwiw) tests are discovered on build and work as expected.
When I try and set up a build pipeline in Azure dev ops, none of my tests are discovered and I get the follow line in the logs:
Test run detected DLL(s) which were built for different framework and platform versions. Following DLL(s) do not match current settings, which are .NETFramework,Version=v4.0 framework and X86 platform.
GenericRepositoryTests.dll is built for Framework .NETCoreApp,Version=v5.0 and Platform AnyCPU.
Microsoft.TestPlatform.CommunicationUtilities.dll is built for Framework .NETStandard,Version=v2.0 and Platform AnyCPU.
There are more Microsoft dlls it reports but you get the idea. Here is my yaml file for the build process:
# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://learn.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- main
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
# Added this step manually
- task: UseDotNet#2
displayName: 'Use .NET Core sdk 5.0.100'
inputs:
packageType: 'sdk'
version: '5.0.100'
includePreviewVersions: true
# Added this step manually
- task: DotNetCoreCLI#2
displayName: 'dotnet restore'
inputs:
command: restore
projects: '**/*.csproj'
- task: NuGetToolInstaller#1
- task: NuGetCommand#2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild#1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest#2
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: |
**\*test*.dll
!**\*TestAdapter.dll
!**\obj\**
searchFolder: '$(System.DefaultWorkingDirectory)'
codeCoverageEnabled: true
How can I make sure the Azure Dev Ops test runner settings are set up to run .net 5 dlls?
Thanks

Thanks to jessehouwing I found that the answer I needed was to use dotnet test rather than VSTest:
Here is my final pipeline:
trigger:
- main
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: UseDotNet#2
displayName: 'Use .NET Core sdk 5.0.100'
inputs:
packageType: 'sdk'
version: '5.0.100'
includePreviewVersions: true
- task: DotNetCoreCLI#2
displayName: 'dotnet restore'
inputs:
command: restore
projects: '**/*.csproj'
- task: DotNetCoreCLI#2
displayName: 'dotnet build'
inputs:
command: 'build'
projects: '**/*.sln'
- task: DotNetCoreCLI#2
displayName: 'dotnet test'
inputs:
command: 'test'
projects: '**/*tests.csproj'
arguments: '--configuration $(buildConfiguration) --collect "Code coverage"'
testRunTitle: 'Generic Repository Tests'

Please try to install the NUnit3TestAdapter <PackageReference Include="NUnit3TestAdapter" Version="3.17.0" /> and then check the result.
See: TFS Tests do not match framework settings for more workarounds.

.csproj
<PackageReference Include="coverlet.collector" Version="3.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Pipeline
trigger: none
pr: none
pool:
vmImage: 'windows-latest'
stages:
- stage: CreateDeploymentArtifacts
displayName: Create Deployment Artifacts
jobs:
- job: Test
displayName: Run Xunit test
steps:
- task: DotNetCoreCLI#2
displayName: 'Restore Packages'
inputs:
command: 'restore'
projects: 'LegalRegTech.Web.sln'
- task: DotNetCoreCLI#2
displayName: 'Build application'
inputs:
command: 'build'
projects: 'LegalRegTech.Web.sln'
arguments: '--no-restore'
- task: DotNetCoreCLI#2
displayName: 'Run tests'
inputs:
command: 'test'
projects: '**/*tests.csproj'
arguments: '--collect:"XPlat Code Coverage"'
- script: 'dotnet tool install -g dotnet-reportgenerator-globaltool'
displayName: 'Install ReportGenerator tool'
- script: 'reportgenerator -reports:$(Agent.TempDirectory)/**/coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)/coverlet/reports -reporttypes:"Cobertura"'
displayName: 'Create reports'
- task: PublishCodeCoverageResults#1
displayName: 'Publish code coverage'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(Build.SourcesDirectory)/coverlet/reports/Cobertura.xml'

Related

Azure devOps pipeLine failed with sonarCloudPrepare

I have this situation ,i trying to build and connect my pipeLine with sonarCloud i have a .net 5.0.x project and .net core 3.1.x , when build the project normally works ok , but when start to add the sonar cloud task starst to fail.
with the next yalm my build is working fine :
trigger:
- qa
- develop
- master
resources:
- repo: self
variables:
tag: '$(Build.BuildId)'
stages:
- stage: Build
displayName: Build image
jobs:
- job: Build
displayName: Build
pool:
vmImage: 'windows-latest'
steps:
- task: UseDotNet#2
displayName: 'Install .NET 5.x.x SDK'
inputs:
version: '5.0.x'
performMultiLevelLookup: true
includePreviewVersions: true # Required for preview versions
- task: UseDotNet#2
displayName: Use Dot Net Core 3.1.x
inputs:
packageType: 'sdk'
version: '3.1.x'
- task: DotNetCoreCLI#2
inputs:
command: 'build'
projects: '**/*.sln'
displayName: 'dotnet build'
But when i add SonarCloudPrepare#1 before my build :
trigger:
- qa
- develop
- master
resources:
- repo: self
variables:
tag: '$(Build.BuildId)'
stages:
- stage: Build
displayName: Build image
jobs:
- job: Build
displayName: Build
pool:
vmImage: 'windows-latest'
steps:
- task: UseDotNet#2
displayName: 'Install .NET 5.x.x SDK'
inputs:
version: '5.0.x'
performMultiLevelLookup: true
includePreviewVersions: true # Required for preview versions
- task: UseDotNet#2
displayName: Use Dot Net Core 3.1.x
inputs:
packageType: 'sdk'
version: '3.1.x'
- task: SonarCloudPrepare#1
inputs:
SonarCloud: 'tp-survey'
organization: 'teleperformance-sonarcloud'
scannerMode: 'MSBuild'
projectKey: tp-cm-back-survey
projectName: 'tp-cm-back-survey'
extraProperties: |
sonar.exclusions="**/bin/**/*,**/obj/**/*,**/Migrations/**,**/*.dll"
sonar.coverage.exclusions="test/**"
sonar.cs.roslyn.ignoreIssues=true
sonar.verbose=true
- task: DotNetCoreCLI#2
inputs:
command: 'build'
projects: '**/*.sln'
displayName: 'dotnet build'
I getting this error :
Command-line syntax error : 'D:\a\1\s\TPSurveyUnitTest\bin\Debug\.netcoreapp,version=v5.0\TPSurveyUnitTest.dll.RoslynCA.json' is not a valid value for the '/errorlog:' option. The value must be of the form '<file>[,version={1|1.0|2|2.1}]'. [D:\a\1\s\TPSurveyUnitTest\TPSurveyUnitTest.csproj]
181 Warning(s)
1 Error(s)
Why are doing wrong ?
i tried adding the restore task but the same error.
Thanks in advance.
The SonarCloud tasks require .NET Core 2.x to be available in the machine. So your fix will be by adding this task before the SonarCloudPrepare task
- task: UseDotNet#2
displayName: 'Install .Net Core sdk 2.1.x (needed for sonar scanner)'
inputs:
version: 2.1.x
- task: DotNetCoreCLI#2
displayName: 'dotnet restore'
inputs:
command: 'restore'
projects: '**/*.csproj'
This is mentioned here in the sonarsource community issue.
https://community.sonarsource.com/t/dotnet-core-3-0-dotnet-sonarscanner/14753
Update:
You should also do dotnet restore before running the scanner.
We tried many of the methods that are indicated in the article. The following helped, the following settings were added to the project (.csproj ):
TEST .csproj
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<OutputPath>..\YourProductPath\bin\Tests\</OutputPath>
MAIN .csproj
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<OutputPath>..\YourProductPath\bin\Release\</OutputPath>
In the pipeline, change the build from .sln to .csproj
- task: DotNetCoreCLI#2
displayName: 'dotnet build'
inputs:
projects: '$(Build.SourcesDirectory)/YourProductPath/YourProduct.csproj'
arguments: '--configuration $(BuildConfiguration)'

Can I mix framework projects and .net standard projects in the same repository? Dotnet Pack command

In the answer to this question I needed to change the build yaml from using Nuget to using DotNet
So that the .net standard project would pack correctly ( i hope ). However when I did this I started getting
error MSB4057: The target "pack" does not exist in the project
for the framework projects.
Should I be separating the repositories or is there some way to specify different pack commands for different targets?
My original azure-pipelines.yml was
# .NET Desktop
# Build and run tests for .NET Desktop or Windows classic desktop solutions.
# Add steps that publish symbols, save build artifacts, and more:
# https://learn.microsoft.com/azure/devops/pipelines/apps/windows/dot-net
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
Major: '2'
Minor: '0'
Patch: '0'
steps:
- task: NuGetToolInstaller#0
inputs:
versionSpec: '>=4.3.0'
checkLatest: true
- task: NuGetCommand#2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild#1
inputs:
solution: '$(solution)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: NuGetCommand#2
inputs:
command: pack
packagesToPack: '**/*.csproj'
versioningScheme: byPrereleaseNumber
majorVersion: '$(Major)'
minorVersion: '$(Minor)'
patchVersion: '$(Patch)'
- task: NuGetCommand#2
inputs:
command: pack
packagesToPack: '**/*.vbproj'
versioningScheme: byPrereleaseNumber
majorVersion: '$(Major)'
minorVersion: '$(Minor)'
patchVersion: '$(Patch)'
- task: NuGetCommand#2
displayName: 'NuGet push'
inputs:
command: push
publishVstsFeed: 'SBDCommonFeed'
allowPackageConflicts: true
but I changed the NuGetCommand#2 task to be
- task: DotNetCoreCLI#2
inputs:
command: 'pack'
outputDir: '$(Build.ArtifactStagingDirectory)/TestDir'
For the Nuget command I can experiment with PackagesToPack
What do I change for the DotNet command?
[Update]
I tried
- task: DotNetCoreCLI#2
inputs:
command: 'pack'
projects: '**/*Standard.csproj'
outputDir: '$(Build.ArtifactStagingDirectory)/OutputDir'
Where *Standard are the .net standard projects. However there was still the MSB4057 error on a framework project
The error indicates you're trying to pack both the .net standard project and .net framework project while you only need to pack the .net standard library project. (Also, dotnet pack should not be used to pack one non-library project.)
So the workaround is to specify the project to pack when using dotnet pack task. The Pack command in .net core task also supports packagesToPack element.
See #packagesToPack: '**/*.csproj' # Required when command == Pack.
Normally the format is:
steps:
- task: DotNetCoreCLI#2
displayName: 'dotnet pack'
inputs:
command: pack
packagesToPack: '**/ProjectName.csproj'
configuration: Release
versioningScheme: xxx
minorVersion: xxx
buildProperties: xxx
...

Azure DevOps Pipeline: can't get tests to compile

I have a solution containing 4 projects (names simplified for clarity)
MyApplication (.Net Standard 2.0)
MyApplication.Test.1 (.Net Core 3.1)
MyApplication.Test.2 (.Net Core 3.1)
MyApplication.Test.3 (.Net Core 3.1)
The solution folder contains the *.sln file, and one folder per project (plus stuff for Git source control).
The three test projects each consume a private NuGet package, "MyNugetPackage"; this package exists on our Azure environment as an artifact. They also use NUnit3 - the test project's NuGet references are as follows:
<PackageReference Include="MyNugetPackage" Version="2020.1.1" />
<PackageReference Include="nunit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
I created the following YAML file for our pipeline:
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
buildConfiguration: release
platform: x64
steps:
- task: NuGetToolInstaller#1
inputs:
versionSpec:
checkLatest: true
- task: NuGetCommand#2
inputs:
command: 'restore'
restoreSolution: '**/*.sln'
feedsToUse: 'select'
vstsFeed: '{GuidA}/{GuidB}'
- task: MSBuild#1
inputs:
solution: '**/*.sln'
msbuildArchitecture: 'x64'
platform: 'Any CPU'
configuration: 'Release'
msbuildArguments: '-m'
clean: true
- task: DotNetCoreCLI#2
inputs:
command: test
projects: '**/*Tests/*.csproj'
arguments: '--configuration Release'
Initially, this failed at the MSBuild step, until I worked out how to set up the permissions for it to pull from our Azure artifact (the vstsFeed property). Having got the MSBuild step to execute successfully, it then fails when the DonNetCoreCLI (Test) step executes: I get multiple messages similar to:
MyTestFile.cs(13,22): error CS0234: The type or namespace name 'ABC'
does not exist in the namespace 'MyNugetPackage' (are you missing an
assembly reference?)
[d:\a\1\s\MyApplication.Test.1\MyApplication.Test.1.csproj]
I'm assuming that this means the Test projects can't find our private 'MyNugetPackage'. But how could this be when MSBuild succeeded?
I tried swapping the MSBuild step out for a Visual Studio build, but to no avail (again, build step worked, test step failed):
- task: VSBuild#1
inputs:
solution: '**\*.sln'
platform: 'any cpu'
configuration: 'release'
clean: true
maximumCpuCount: true
msbuildArchitecture: 'x64'
I then tried swapping the MSBuild step for the .NET Core build so that it matched the job for the tests
- task: DotNetCoreCLI#2
displayName: Build
inputs:
command: build
projects: '**/*.csproj'
arguments: '--configuration Release'
And now the BUILD step failed.
So it seems to me that I have two routes forward:
Either stick with either MSBuild or Visual Studio Build, and work out how to then execute my tests, or
Work out how to compile successfully with DotNetcoreCLI#2 rather than use MSBuild/Visual Studio Build, and hope that the tests will then work as expected
The documentation from Microsoft seemed so simple (Run your tests)....hoping someone can help guide me on the right path.
You can run dotnet test command on your local machine to check if it works fine locally. Make sure you can successfully build and test your projects locally first.
In you pipeline, You can try use vstest task after msbuild task to run the tests.
- task: VSTest#2
inputs:
testAssemblyVer2: |
**\*[Tt]est*.dll
!**\*[Tt]estAdapter*.dll
!**\obj\**
searchFolder: $(system.defaultworkingdirectory)
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
You can also run Dotnet restore task to restore the packages before dotnet test task
- task: DotNetCoreCLI#2
displayName: 'dotnet restore'
inputs:
command: restore
projects: '**/*.csproj'
feedsToUse: select
vstsFeed: 'nugettest'
So the solution that (eventually) worked for me was to use the .Net Core (DotNetCoreCLI#2) build, and to break every step apart, e.g.
# 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: 'windows-latest'
variables:
buildConfiguration: 'Release'
platform: x64
steps:
- task: DotNetCoreCLI#2
displayName: 'Restore for MyApplication'
inputs:
command: 'restore'
projects: 'MyApplication/*.csproj'
feedsToUse: 'select'
vstsFeed: '{GuidA}/{GuidB}'
- task: DotNetCoreCLI#2
displayName: 'Restore for MyApplication.Test.1'
inputs:
command: 'restore'
projects: 'MyApplication.Test.1/*.csproj'
feedsToUse: 'select'
vstsFeed: '{GuidA}/{GuidB}'
- task: DotNetCoreCLI#2
displayName: 'Restore for MyApplication.Test.2'
inputs:
command: 'restore'
projects: 'MyApplication.Test.2/*.csproj'
feedsToUse: 'select'
vstsFeed: '{GuidA}/{GuidB}'
- task: DotNetCoreCLI#2
displayName: 'Restore for MyApplication.Test.3'
inputs:
command: 'restore'
projects: 'MyApplication.Test.3/*.csproj'
feedsToUse: 'select'
vstsFeed: '{GuidA}/{GuidB}'
- task: DotNetCoreCLI#2
displayName: 'Build MyApplication'
inputs:
command: 'build'
projects: 'MyApplication/*.csproj'
- task: DotNetCoreCLI#2
displayName: 'Build Test.1'
inputs:
command: 'build'
projects: 'MyApplication.Test.1/*.csproj'
- task: DotNetCoreCLI#2
displayName: 'Build Test.2'
inputs:
command: 'build'
projects: 'MyApplication.Test.2/*.csproj'
- task: DotNetCoreCLI#2
displayName: 'Build Test.3'
inputs:
command: 'build'
projects: 'MyApplication.Test.3/*.csproj'
- task: DotNetCoreCLI#2
displayName: 'Execute Test.1s'
inputs:
command: 'test'
projects: 'MyApplication.Test.1/*.csproj'
- task: DotNetCoreCLI#2
displayName: 'Execute Test.2s'
inputs:
command: 'test'
projects: 'MyApplication.Test.2/*.csproj'
- task: DotNetCoreCLI#2
displayName: 'Execute Test.3s'
inputs:
command: 'test'
projects: 'MyApplication.Test.3/*.csproj'

Azure Pipeline for .NET Core 3.0 P9 does not work

I have a simple Blazor project using 3.0 P9 which builds fine on my local machine, checked it into azure devops, created a pipe getting
C:\hostedtoolcache\windows\dotnet\sdk\3.0.100-preview9-014004\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(234,5):
Error NETSDK1004: Assets file
'd:\a\1\s\projectname\obj\project.assets.json' not found. Run a
NuGet package restore to generate this file. Process 'msbuild.exe'
exited with code '1'.
when running the pipeline with following yaml (task UseDotNet#2 and DotNetCoreInstaller#0 were added to the default generated pipeline code)
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller#1
- task: DotNetCoreInstaller#0
displayName: 'Install .net core 3.0 (preview)'
inputs:
version: '3.0.100-preview9-014004'
- task: UseDotNet#2
inputs:
version: 3.x
includePreviewVersions: true
- task: DotNetCoreCLI#2
displayName: 'dotnet restore'
inputs:
command: restore
projects: '**/projectname.csproj'
- task: VSBuild#1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest#2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
Azure Pipeline for .NET Core 3.0 P9 does not work
To resolve this issue, please add a dotnet restore task before the task Visual Studio build:
- task: DotNetCoreCLI#2
displayName: 'dotnet restore'
inputs:
command: restore
projects: '**/YourProjectName.csproj'
vstsFeed: 'XXXX'
The error occurs because the dotnet cli does not create the all of the required files initially. Doing dotnet restore adds the required files.
Hope this helps.
this fixed it for me
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: DotNetCoreInstaller#0
displayName: 'Install .net core 3.0 (preview)'
inputs:
version: '3.0.100-preview9-014004'
- task: NuGetToolInstaller#1
- task: NuGetCommand#2
inputs:
restoreSolution: '$(solution)'

Azure devops .netcore fails but builds fine in visual studio

--Fixed it... Geez this stuff is Janky.
Microsoft link to explain what to do
https://learn.microsoft.com/en-us/aspnet/core/migration/21-to-22?view=aspnetcore-2.2&tabs=visual-studio
I had to remove the version tag from the Microsoft.AspNetCore.All references in the csproj file.
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" **DELETE Version Version="2.2.0" />
--Edit 12/4
I I installed on my PC .netcore to 2.2, Now it fails the same. I didn't change a setting in my Project. I am specifying in my project settings to use 2.1 not 2.2.
It appears in the YAML where i set the .netcore version is not applying.
- task: DotNetCoreInstaller#0
displayName: 'Use .NET Core Tool Installer'
inputs:
version: 2.1.500
I am not sure what to do now.
--
I get following error when building in azure devops or publish from VS to an Azure app service. Visual Studio builds it fine.
(Restore target) -> 2018-12-04T01:30:44.4900171Z
D:\a\1\s\cbw.services\cbw.mvc.services.csproj : error NU1202: Package
Microsoft.AspNetCore.All 2.2.0 is not compatible with netcoreapp2.1
(.NETCoreApp,Version=v2.1). Package Microsoft.AspNetCore.All 2.2.0
supports: netcoreapp2.2 (.NETCoreApp,Version=v2.2)
My Build YAML
resources:
- repo: self
queue:
name: Hosted VS2017
steps:
- task: DotNetCoreInstaller#0
displayName: 'Use .NET Core Tool Installer'
inputs:
version: 2.1.500
- task: NuGetToolInstaller#0
displayName: 'Use NuGet 4.9.1'
inputs:
versionSpec: 4.9.1
#- task: NuGetCommand#2
# displayName: 'NuGet restore'
# inputs:
# restoreSolution: '***.sln'
# feedsToUse: config
# nugetConfigPath: 'NuGet.config'
# externalFeedCredentials: <Name of the NuGet service connection>
- task: DotNetCoreCLI#2
displayName: Restore
inputs:
command: restore
projects: '**/*.sln'
feedsToUse: config
nugetConfigPath: NuGet.config
- task: DotNetCoreCLI#2
displayName: Build
inputs:
projects: '**/*.sln'
arguments: '--configuration $(BuildConfiguration)'
- task: DotNetCoreCLI#2
displayName: Test
inputs:
command: test
projects: '**/*Tests/*.csproj)'
arguments: '--configuration $(BuildConfiguration)'
#- task: DotNetCoreCLI#2
# displayName: Publish
# inputs:
# command: publish
# publishWebProjects: True
# arguments: 'release --output $(build.artifactstagingdirectory)'
- task: DotNetCoreCLI#2
displayName: 'dotnet publish'
inputs:
command: 'publish'
publishWebProjects: True
projects: '**/*.sln'
arguments: release -o $(build.artifactStagingDirectory)
zipAfterPublish: True
modifyOutputPath: false
- task: PublishBuildArtifacts#1
displayName: 'Publish Artifact'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
- task: AzureRmWebAppDeployment#3
inputs:
azureSubscription: 'Azure CBW Dev'
WebAppName: 'cbwServicesDev'
Package: $(System.artifactstagingdirectory)/**/*.zip
You need to add the .NET Core SDK installer task to your build.
Edit: It needs to be the first task, or at least before any build task.
A good post by Scott Hanselman walks you through this problem.