I have this yaml pipeline in Azure DevOps:
variables:
solution: 'fph.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- xxxx
- 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" /t:FPH_Api\FPH_Api_csproj;Rebuild'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
The solution contain multiple projects and I am hoping that by providing DesktopBuildPackageLocation
parameter and target parameter FPH_Api\FPH_Api_csproj;Rebuild
, VSBuild will rebuild my web api project (so will rebuild other referenced projects as well) and then automatically zip the build into webapp.zip
.
However, I got this error:
FPH_Api\FPH_Api_csproj" does not exist in the project.
I replaced the dots in FPH.API\FPH.api.csproj
with underscores as dot is a forbidden character and tried several combinations like FPH_Api\FPH_Api
or FPH_Api
, but got the same error message.
Detail error shows this:
Project "D:\a\1\s\fph.sln" (1) is building "D:\a\1\s\FPH.Api\FPH.Api.csproj" (2) on node 1 (FPH_Api\FPH_Api_csproj target(s)).
D:\a\1\s\FPH.Api\FPH.Api.csproj : error MSB4057: The target "FPH_Api\FPH_Api_csproj" does not exist in the project.
Done Building Project "D:\a\1\s\FPH.Api\FPH.Api.csproj" (FPH_Api\FPH_Api_csproj target(s)) -- FAILED.
Seems the way I am doing things is not correct. So is it possible to use the VSBuild task to build a project in a solution and automatically zip the output?