I have a project using dotnet framework 4.8. I'm building a pipeline in azure devops and want a zip-file for each library in the solution. How do I do that?

Elu 0 Reputation points
2024-02-01T09:13:51.9533333+00:00

Hi! I have a solution with several librarys and each library has it's own website. I want to build a pipeline that has a zip-file for each site thet I can use in the release instead of having one big zip-file for all websites. How do I do that?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,634 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Grmacjon-MSFT 17,886 Reputation points
    2024-02-08T01:47:38.4066667+00:00

    Hi @Elu ,

    This is achevable, you can create a separate Azure DevOps pipeline for each library’s website, and generate a zip file specifically for that site. Here are the steps to set up your pipeline:

    1. Create a Pipeline for Your Stack:
    • Sign in to your Azure DevOps organization.
    • Navigate to your project.
    • Go to Pipelines, then select New Pipeline.
    • Choose the location of your source code (either Azure Repos Git or GitHub).
    • Select your repository.

    Configure the pipeline for your specific stack (e.g., ASP.NET Core).

    2.Add the Deployment Task:

    • In your pipeline YAML file, add the Azure Web App task (AzureWebApp) to deploy to Azure App Service.
    • Alternatively, you can use the Azure App Service deploy task (AzureRmWebAppDeployment) for more complex scenarios.
    • Specify your Azure subscription, App type, App name, and Runtime stack based on your App Service app. Your YAML should look similar to the following:
    trigger:
      branches:
        include:
          - main
    
    pool:
      vmImage: 'ubuntu-latest'
    
    steps:
      - task: UseDotNet@2
        inputs:
          packageType: 'sdk'
          version: '3.x'
          installationPath: $(Agent.ToolsDirectory)/dotnet
    
      # Other build steps go here...
    
      - task: ArchiveFiles@2
        inputs:
          rootFolderOrFile: '$(Build.BinariesDirectory)'
          includeRootFolder: false
          archiveType: 'zip'
          archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
          replaceExistingArchive: true
    
      - task: AzureWebApp@1
        inputs:
          azureSubscription: '<your-subscription>'
          appType: 'webApp'
          appName: '<your-app-name>'
          package: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
          deploymentMethod: 'auto'
    

    3.Repeat Steps for Each Library:

    • Create a similar pipeline for each library’s website.

    Customize the pipeline YAML for each site by adjusting the source code location, stack, and other parameters.

    4.Release the Zip Files:

    • After successful builds, you’ll have separate zip files for each site in the Artifacts folder.
    • These zip files can be used in your release process.

    Remember to replace placeholders like <your-subscription> and <your-app-name> with actual values specific to your environment. Best,

    Grace

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.