简体   繁体   中英

azure build pipeline error using resharper task

I am trying to make an Azure DevOps build pipeline for a .net web app that runs my unit tests, builds the app and then runs Resharper code analysis on the solution and if there are no major issues with code analysis, it will publish an artifact. When I manually run this pipeline I get the following error:

##[error]No solution or project found at C:\Users\35385\source\repos\DevOpsCA2\BMICalculator.sln

I am not sure why I am getting this as this is the correct path to the solution.. Can anyone see what I am doing wrong?

My .yaml pipeline:

trigger:
- master

pool:
  vmImage: 'windows-latest'

variables:
  buildConfiguration: 'Release'

steps:

- task: DotNetCoreCLI@2
  inputs:
    command: test
    projects: '**/BMIUnitTestProject/*.csproj'
    arguments:  '--configuration $(buildConfiguration)'


- script: dotnet build --configuration $(buildConfiguration)
  displayName: 'dotnet build $(buildConfiguration)'

- task: ResharperCli@2
  inputs:
    solutionOrProjectPath: 'C:\Users\35385\source\repos\DevOpsCA2\BMICalculator.sln'
    additionalArguments: '--properties:Configuration=$(Build.Configuration)'

- task: DotNetCoreCLI@2
  displayName:  'dotnet publish --configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)'
  inputs:
    command: publish
    publishWebProjects: true
    projects: '**/BMICalculator/*.csproj'
    arguments: '--configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)'
    zipAfterPublish: true

- task: PublishBuildArtifacts@1
  displayName: 'publish artifacts'

You use Microsoft hosted agent windows-latest , it's a new fresh machine, the build is not run on your PC, so the solution not exist in this path.

You should specify the path in the agent machine, for example:

$(Build.SourcesDirecotry)\DevOpsCA2\BMICalculator.sln

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM