skip to Main Content

How to get page wise DLL for my web application aspx pages in azure build pipeline. While I run my pipeline its creating single build for my complete we application. But I want page wise dll for my web application.

I tried many ways in YAML file and classic editor tasks but could not get page wise dll.

- script: |
    for /r %%i in (*.aspx) do (
      echo Compiling page: %%i
      "C:WindowsMicrosoft.NETFrameworkv4.0.30319aspnet_compiler" -v / -p "%%~dpi" -u -f -fixednames "output%%~ni" 
      echo Compilation complete for: %%i
    )
  displayName: 'Compile ASPX Pages'

I had tried above script in yaml file and some other ways but getting

##[error]Cmd.exe exited with code ‘1’ this error

I also tried MSBuild Arguments in publish build artifacts in azure pipeline but the issue remain same…

2

Answers


  1. Chosen as BEST ANSWER

    # ASP.NET
    # Build and test ASP.NET projects.
    # Add steps that publish symbols, save build artifacts, deploy, and more:
    # https://docs.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4
    
    trigger:
    - Production
    
    pool:
      vmImage: windows-latest
    
    variables:
      solution: '**/*.sln'
      buildPlatform: 'Any CPU'
      buildConfiguration: 'Release'
    
    steps:
    - task: NuGetCommand@2
      inputs:
        command: 'restore'
        restoreSolution: '**/*.sln'
        feedsToUse: 'select'
        vstsFeed: '***'
    
    - task: MSBuild@1
      inputs:
        solution: '**/*.sln'
        msbuildArchitecture: 'x64'
        platform: '$(buildPlatform)'
        configuration: '$(buildConfiguration)'
    
    - task: CmdLine@2
      inputs:
        script: 'C:WindowsMicrosoft.NETFrameworkv4.0.30319aspnet_compiler.exe -v / -p $(Build.SourcesDirectory) -c -fixednames $(Build.SourcesDirectory)objReleaseAspnetCompileMergeTempBuildDir'
    
    - task: PublishPipelineArtifact@1
      inputs:
        targetPath: '$(Build.SourcesDirectory)objReleaseAspnetCompileMergeTempBuildDirbin'
        artifact: 'drop'
        publishLocation: 'pipeline'

    This is my YAMAL file and my project files are under TestDemo2 Folder after root directory in azure files and this is web application.


  2. To get page wise DLL for you web application aspx pages, you can refer to the below yaml file:

    pool:
      vmImage: windows-latest
    
    variables:
      solution: '**/*.sln'
      buildPlatform: 'Any CPU'
      buildConfiguration: 'Release'
    
    steps:
    - task: NuGetCommand@2
      inputs:
        command: 'restore'
        restoreSolution: '**/*.sln'
        feedsToUse: 'select'
        vstsFeed: '***'
    
    - task: MSBuild@1
      inputs:
        solution: '**/*.sln'
        msbuildArchitecture: 'x64'
        platform: '$(buildPlatform)'
        configuration: '$(buildConfiguration)'
    
    - task: CmdLine@2
      inputs:
        script: 'C:WindowsMicrosoft.NETFrameworkv4.0.30319aspnet_compiler.exe -v / -p $(Build.SourcesDirectory) -c -fixednames $(Build.SourcesDirectory)objReleaseAspnetCompileMergeTempBuildDir'
    
    - task: PublishPipelineArtifact@1
      inputs:
        targetPath: '$(Build.SourcesDirectory)objReleaseAspnetCompileMergeTempBuildDirbin'
        artifact: 'drop'
        publishLocation: 'pipeline'
    

    In the CmdLine@2 task, use -p to specify the physical path of the application to be compiled. The output of aspnet_compiler.exe will be placed into $(Build.SourcesDirectory)objReleaseAspnetCompileMergeTempBuildDir.

    In PublishPipelineArtifact@1 task, set the PublishPipelineArtifact@1 to the bin folder inside the output folder of aspnet_compiler.exe.

    Then you can see the .dll files of your aspx pages in the pipeline artifact:
    enter image description here

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