Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

ASPZERO V12 to 13.4 Upgrade: Angular App Build Issues in DevOps Pipeline #12210


User avatar
0
pliaspzero created

Dear Support Team,

We have set up a CI/CD pipeline in DevOps for direct deployment of both the API and the Angular application. Based on version 12, everything worked smoothly.

We recently copied the pipeline and adjusted it to build with the .NET 8 framework for version 13.4. The API continues to run without issues, but the Angular app no longer builds or is not copied over correctly. The "dist" folder in wwwroot is missing.

Do you have any suggestions or insights into what might be causing this problem?

Below are excerpts from the package.json and the pipeline definition.

package.json { "name": "abp-zero-template", "version": "13.4.0", "license": "MIT", "angular-cli": {}, "scripts": { "ng": "ng", "publish": "gulp build && ng build --configuration production", "lint": "eslint -c .eslintrc.js --ext .ts src", "post-publish": "shx mv ./wwwroot/dist/* ./wwwroot/", "publish-k8s": "gulp build && ng build --configuration k8s --verbose", "start": "ng serve --host 0.0.0.0 --port 4200", "hmr": "gulp buildDev && ng serve --host 0.0.0.0 --port 4200 --hmr", "test": "gulp buildDev && ng test", "create-dynamic-bundles": "gulp buildDev", "nswag": "cd nswag/ && refresh.bat", "build": "ng build --configuration production" },

trigger: branches: include: - refs/heads/master batch: True name: $(date:yyyyMMdd)$(rev:.r) resources: repositories:

  • repository: self type: git ref: refs/heads/dev jobs:
  • job: Job_1 displayName: Agent job 1 timeoutInMinutes: 0 cancelTimeoutInMinutes: 60 pool: name: PLIVM001 steps:
    • checkout: self

    • task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3 displayName: Clean Agent Directories

    • task: UseDotNet@2 displayName: Use .NET Core sdk 8.0.x inputs: version: 8.0.x vsVersion: 17.8.3 includePreviewVersions: true performMultiLevelLookup: true

    • task: NodeTool@0 displayName: Use Node 20.x inputs: versionSpec: 20.x

    • task: CmdLine@2 displayName: Command Line Script inputs: script: >+ rmdir /s /q node_modules

      npm cache clean --force
      
    • task: DotNetCoreCLI@2 displayName: Restore inputs: command: restore projects: '**/MyApp.Web.Host.csproj' custom: restore arguments: --force feedRestore: 61e6cd5a-e31d-46dd-973a-caeced7a75fd/a94ff0e1-806f-4475-a711-137a0f2b1dde nugetConfigPath: Saml package/nuget.exe noCache: true verbosityRestore: Diagnostic verbosityPack: Detailed

    • task: DotNetCoreCLI@2 displayName: Build inputs: projects: '**/MyApp.Web.Host.csproj' arguments: --configuration $(BuildConfiguration) verbosityRestore: Detailed verbosityPack: Detailed

    • task: CmdLine@2 displayName: Command Line Script continueOnError: True inputs: script: >- npm install gulp-sass -ES --unsafe-perm=true

      npm update node-sass@latest
      

      workingDirectory: src/MyApp.Web.Host

    • task: geeklearningio.gl-vsts-tasks-yarn.yarn-task.Yarn@3 displayName: 'Yarn ' continueOnError: True inputs: projectDirectory: src/MyApp.Web.Host productionMode: true customFeed: c3c4c89e-67c6-4c90-8cda-19db656fbb9d

    • task: CmdLine@2 displayName: Command Line Script gulp continueOnError: True inputs: script: >2-

      sudo npm install -g gulp
      
      yarn add gulp
      
      npm run build
      

      workingDirectory: src/MyApp.Web.Host

    • task: DotNetCoreCLI@2 displayName: Publish inputs: command: publish publishWebProjects: false projects: '**/MyApp.Web.Host.csproj' arguments: --configuration $(BuildConfiguration) --output $(build.artifactstagingdirectory) zipAfterPublish: True verbosityRestore: Detailed verbosityPack: Detailed

    • task: DotNetCoreCLI@2 displayName: dotnet publish inputs: command: publish publishWebProjects: false projects: '**/MyApp.Migrator.csproj' arguments: --configuration $(BuildConfiguration) --output $(build.artifactstagingdirectory) zipAfterPublish: false verbosityRestore: Detailed verbosityPack: Detailed

    • task: PublishBuildArtifacts@1 displayName: Publish Artifact condition: succeededOrFailed() inputs: PathtoPublish: $(build.artifactstagingdirectory) TargetPath: '\my\share$(Build.DefinitionName)$(Build.BuildNumber)'

    • task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3 displayName: Clean Agent Directories copy ...

Best regards, Oliver


3 Answer(s)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi pliaspzero

    Is your project a merged Angular application?

  • User Avatar
    0
    pliaspzero created

    yes

  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi pliaspzero

    Your package.json's post-publish script uses shx to move the dist folder contents, but it seems not to be executing successfully. Try changing the post-publish to run explicitly in the pipeline with a custom command after the npm run build

    task: CmdLine@2
    displayName: Move Dist to wwwroot
    inputs:
      script: 'mv ./dist/* ./wwwroot/'
    workingDirectory: src/MyApp.Web.Host
    

    When the publish is completed, go to the publish directory and move all files from wwwroot/dist to wwwroot folder.

    Make sure the dist folder is created