M Leipper
M Leipper

Reputation: 397

error MSB1003: Specify a project or solution file. building a pipeline with azure and can't find csproj file

Hi I've got a solution that has multiple projects held within it where I'm hoping to automate the build and deployment of the webapplication within the project.

on my HD the dir looks like C:\Users\mleip\source\repos\edocs.utils.bluebeam-api\edocs.utils.bluebeam-api.Caller\edocs.utils.CDEComms , however, when I run the below yaml i get

 MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.




trigger:
- master

pool:
  vmImage: 'ubuntu-latest'

variables:
  buildConfiguration: 'Release'

steps:
- script: dotnet restore 
- powershell:  |
    Write-Host "Your parameter is now: $env:Param"
    Write-Host "When outputting standard variable build id: $(Build.BuildId)"
    Write-Host "When outputting standard variable build id via env: $env:BuildNumber"
    Write-Host "The repo name is: $(Build.Repository.Name)"
    Write-Host "The build definition name is: $(Build.DefinitionName)"
- script: dotnet build --configuration $(buildConfiguration)
  displayName: 'dotnet build $(buildConfiguration)'
- task: DotNetCoreCLI@2
  inputs:
    command: 'build'
    projects:  '**/edocs.utils.bluebeam-api.Caller/edocs.utils.CDEComms/edocs.utils.CDEComms.csproj'

So far I have tried several combinations of dir for where azure should locate the build file, however, each time it fails. The solution has several projects within it. CDEComms is the only project within that folder so I'm left quite confused as to what's going on.

I'm quite new to building pipelines and any help as to why this is failing would be greatly appreciated.

Upvotes: 0

Views: 8166

Answers (2)

Cece Dong - MSFT
Cece Dong - MSFT

Reputation: 31003

In order to narrow down the issue, try to simply specify **/*.csproj in the YAML file to check the build result. And set variable system.debug to True, to check whether the path is correct in C:\hostedtoolcache\windows\dotnet\dotnet.exe build {path}. Also, clone the repo to your local machine to run build it locally, to check the result.

Upvotes: 2

Potatojaisiladki
Potatojaisiladki

Reputation: 87

From the description you have provided, you will first have to push your code/solution i.e. the content of your C:\ drive to your repository.

Upvotes: 0

Related Questions