0
votes

I have a Visual Studio Solution (.sln) with 2 projects:

  • ASP.NET MVC (principal) produces zip with all files to publish in IIS
  • Database Project that produces .dacpac file to publish in SQL-Server

I generated a Pipeline to generate the Artifact of the Web and DB projects, but it doesn't include the .dacpac file.

this is my yml:

trigger:
- master

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: VSTest@2
  inputs:
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: CopyFiles@1
  inputs:
    Contents: '*.dacpac'
    TargetFolder: '$(build.artifactStagingDirectory)'

- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'drop'
    publishLocation: 'Container'

I tried to add the Database project as a dependency of the Web Project but I get the same result.

I'm not sure if it is generating it:

Result of pipeline job run

I tried to manually copy (as you can see on yml) but not found it: File not found on manually copy

Any idea?

1

1 Answers

0
votes

Solved changing source folder and contents on CopyFile task

- task: CopyFiles@1
  inputs:
    SourceFolder: '$(System.DefaultWorkingDirectory)'
    Contents: 'it-EMDB/bin/$(BuildConfiguration)/*'
    TargetFolder: '$(Build.ArtifactStagingDirectory)'