0

I am trying to build a solution using CI pipeline. It is an old ASP.NET Web Forms Site. The yaml file is as follows

trigger:
- main

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
- 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:PackageLocation="$(build.artifactstagingdirectory)"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(build.artifactStagingDirectory)'
    ArtifactName: 'PublishBuildArtifacts'

After build nothing is copied to artifact 'PublishBuildArtifacts' and I see a message "Directory 'D:\a\1\a' is empty. Nothing will be added to build artifact 'PublishBuildArtifacts'." My understanding is that via PackageLocation property the package would be in artifactstagingdirectory folder which should be published in the next step. What am I missing here? Do I need to use copyfile task? If so what would be the source and target folders? Thanks

1
  • How do you get the ,sln file in your 'ASP.NET WEBSITE' i also have website project wcshich dont have solution and project file. when check with developer they told me, for website we dont have any solution or project file.. So i really dont know how to build it...Please feel free to answer for the [below question by me stackoverflow.com/questions/76216606/… Commented May 11, 2023 at 8:57

1 Answer 1

2

You may add CopyFiles task before PublishBuildArtifacts task :

- task: CopyFiles@2
  displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
  inputs:
    SourceFolder: '$(agent.builddirectory)'
    TargetFolder: '$(Build.ArtifactStagingDirectory)'

- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(build.artifactStagingDirectory)'
    ArtifactName: 'PublishBuildArtifacts'
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. Works great.
Please look the below question which posted by me and guide me. Thanks! stackoverflow.com/questions/76216606/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.