skip to Main Content

I’m new to Azure DevOps. I have a repo that contains multiple solutions and each solution contains multiple projects. These projects have dependencies on each other. Projects are targeting .NET 4.7.1. Building all of them in order, I get a package for a WPF application.

I would like to create one Azure YAML pipeline but I’m not sure about the correct way.

This is my pipeline at the moment:

trigger:
  - none
#- desarrollo

pool:
  vmImage: 'windows-latest'

variables:
  buildPlatform: 'x64'
  buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@1

- task: NuGetCommand@2
  inputs:
    restoreSolution: 'Folder1/Solution_A.sln'

- task: VSBuild@1
  inputs:
    solution: 'Folder1/Solution_A.sln'
    msbuildArgs: '/p:AzureBuild=true /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: MSBuild@1
  inputs:
   solution: 'Folder2/Solution_B/Project_B1.csproj'
   msbuildArguments: '/p:AzureBuild=true /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(Build.ArtifactStagingDirectory)"'
   platform: '$(buildPlatform)'
   configuration: '$(buildConfiguration)'

- task: CopyFiles@2
  displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
  inputs:
    SourceFolder: '$(Build.SourcesDirectory)'
    Contents: '**binrelease**'
    flattenFolders: false
    TargetFolder: '$(Build.ArtifactStagingDirectory)'

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

Solution_B.Project_B1 has a dependency on the project Solution_A.Project_A1 and Solution_A.Project_A1 has a dependency on Solution_A.Project_A2.

When running the pipeline, I get an error on MsBuild@1 task because it has not found Solution_A.Project_A2.dll.

What is the best way to do I need?

2

Answers


  1. Chosen as BEST ANSWER

    Finally, the pipeline is working. I had an error because of one project was not configured for x64 platform. And the outputh of the project was binrelease but binx64release where the other project was find it.


  2. Would you consider publishing the dependency generated by Solution_A.Project_A1 to Azure Artifacts for one time?

    You may restore that dependency from that feed before building Solution_B.

    - task: DotNetCoreCLI@2
      inputs:
        command: 'restore'
        projects: 'Solution_B.sln'
        feedsToUse: 'select'
        vstsFeed: '$(ProjectName)/$(ProjectScopeFeed-NuGet)'
    

    Thus, you don’t have to build the two solutions together every time.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search