I got this error when I was running pipeline on .Net6 core project made on VS2022. After changing pool vmimage
to windows-2022
from windows-latest
, things worked for me.
Reference MS Documentation
Also added latest version for Nugetinstalle
Nuget versions
steps:
- task: NuGetToolInstaller@1
inputs:
versionSpec: '6.1'
checkLatest: true
Now my pipeline looks like this,
trigger:
- master
pool:
vmImage: 'windows-2022'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
inputs:
versionSpec: '6.1'
checkLatest: true
- 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)'