Can't seem to build v4.20 on Azure Pipelines

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 years ago
Hey everyone,

I'm having trouble getting a (brand new) instance of v4.20 to run on my Azure Build pipeline. I'm seeing an error when each plugin project is built when ClearPluginAssemblies is run. Strangely, this is only happening when I try to build against Microsoft Azure's build agents (Hosted VS2017). When I build the solution in my local environment it succeeds every time. Here's a sample of the logs when I try to build using an Azure agent:


C:\hostedtoolcache\windows\dncs\2.2.301\x64\sdk\2.2.301\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets(153,5): warning NETSDK1071: A PackageReference to 'Microsoft.AspNetCore.App' specified a Version of `2.2.5`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs [d:\a\3280\s\Libraries\Nop.Core\Nop.Core.csproj]
  Nop.Core -> d:\a\3280\s\Libraries\Nop.Core\bin\debug\netcoreapp2.2\Nop.Core.dll
  Nop.Data -> d:\a\3280\s\Libraries\Nop.Data\bin\debug\netcoreapp2.2\Nop.Data.dll
  Nop.Services -> d:\a\3280\s\Libraries\Nop.Services\bin\debug\netcoreapp2.2\Nop.Services.dll
  Nop.Web.Framework -> d:\a\3280\s\Presentation\Nop.Web.Framework\bin\debug\netcoreapp2.2\Nop.Web.Framework.dll
  Nop.Plugin.DiscountRules.CustomerRoles -> d:\a\3280\s\Presentation\Nop.Web\Plugins\DiscountRules.CustomerRoles\Nop.Plugin.DiscountRules.CustomerRoles.dll
  No executable found matching command "dotnet-d:\a\3280\s\Build\ClearPluginAssemblies.dll"
d:\a\3280\s\Build\ClearPluginAssemblies.proj(21,5): error MSB3073: The command "dotnet "d:\a\3280\s\Build\ClearPluginAssemblies.dll" "OutputPath=d:\a\3280\s\Build\..\Presentation\Nop.Web\bin\debug\netcoreapp2.2\|PluginPath=d:\a\3280\s\Plugins\Nop.Plugin.DiscountRules.CustomerRoles\..\..\Presentation\Nop.Web\Plugins\DiscountRules.CustomerRoles\|SaveLocalesFolders="" exited with code 1.

Build FAILED.

C:\hostedtoolcache\windows\dncs\2.2.301\x64\sdk\2.2.301\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets(153,5): warning NETSDK1071: A PackageReference to 'Microsoft.AspNetCore.App' specified a Version of `2.2.5`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs [d:\a\3280\s\Libraries\Nop.Core\Nop.Core.csproj]
d:\a\3280\s\Build\ClearPluginAssemblies.proj(21,5): error MSB3073: The command "dotnet "d:\a\3280\s\Build\ClearPluginAssemblies.dll" "OutputPath=d:\a\3280\s\Build\..\Presentation\Nop.Web\bin\debug\netcoreapp2.2\|PluginPath=d:\a\3280\s\Plugins\Nop.Plugin.DiscountRules.CustomerRoles\..\..\Presentation\Nop.Web\Plugins\DiscountRules.CustomerRoles\|SaveLocalesFolders="" exited with code 1.
    1 Warning(s)
    1 Error(s)

Thanks in advance for your help!
4 years ago
Anyone?
4 years ago
Hey everyone, I figured out what the issue was. Just in case anyone has the same problem, here's what I found.

When nopCommerce v4.2 is shipped, the ClearPluginAssemblies solution is included as already built and packaged into ClearPluginAssemblies.dll. However, when I checked in the source code into our version control (TFVC in my case), DLL files are excluded by default. Once I manually checked in this DLL file, the solution built with no problem.
4 years ago
Thanks for sharing. :)
4 years ago
Did you solve the problem? If yes, can you share the complete YAML file?

Thanks a lot.
4 years ago
@havana7 The YAML file for my Azure Pipelines Build? Sure, but I don't know if it will be helpful to you. In my build pipeline I'm building a docker image from my nopCommerce 4.2 solution and storing in AWS ECR. Let me know if posting this would be helpful.

If you want to know how to do a normal build (not for Docker), use the Azure Pipelines template for ASP.NET Core. Use the .NET Core action in the Visual Assistant to create build, test, and publish actions. Then create a Release Pipeline to push that compiled solution to a web environment. Hope this helps!
3 years ago
Were u able to make this work? Could you share your pipeline?
3 years ago
Figured out what worked on 4.1 and 4.2.
This pipeline is for master branch, and if you're not using npm or webpack you can remove those lines. Italic font.


resources:
- repo: self

trigger:
  branches:
    include:
    - master

pool:
  name: Hosted
  demands: npm

steps:
- task: UseDotNet@2
  displayName: 'Use .NET Core sdk'
  inputs:
    packageType: sdk
    version: 2.2.203
- task: Npm@1
  displayName: 'npm install'
  inputs:
    workingDir: src/Presentation/Nop.Web
- task: Npm@1
  displayName: 'npm webpack'
  inputs:
    command: custom
    workingDir: src/Presentation/Nop.Web
    customCommand: 'run start'

- task: DotNetCoreCLI@2
  displayName: 'dotnet restore'
  inputs:
    command: restore
    projects: src/*.sln
    
- task: DotNetCoreCLI@2
  displayName: 'dotnet build'
  inputs:
    projects: src/*.sln
    arguments: '--configuration release'

- task: DotNetCoreCLI@2
  displayName: Publish
  inputs:
    command: publish
    publishWebProjects: True
    arguments: '--configuration release --output $(build.artifactstagingdirectory)'

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact'
  inputs:
    artifactName: 'drop-yaml'
    PathtoPublish: '$(build.artifactstagingdirectory)'
3 years ago
I am posting the successful yaml pipeline. Only thing is restore takes some time(2-3 mins).If anyone has something to reduce it please post

# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core

trigger:
- main

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**\*.csproj'
  buildsolution: '**\*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@1

- task: DotNetCoreCLI@2
  displayName: dotnet restore
  inputs:
    command: restore
    projects: '$(solution)'
    
- task: UseDotNet@2
  displayName: ".NET Core 3.1.x"
  inputs:
    version: '3.1.x'
    includePreviewVersions: true # Required for preview versions
- task: VSBuild@1
  displayName: "Build Solution"
  inputs:
    vsVersion: "16.0"
    solution: '$(buildsolution)'
    

- task: DotNetCoreCLI@2
  displayName: 'Publish'
  inputs:
    command: 'publish'
    publishWebProjects: true
    arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)/WebApp'
    zipAfterPublish: true

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact'
  inputs:
      targetPath: '$(Build.ArtifactStagingDirectory)'
      artifactName: 'drop'
  condition: succeededOrFailed()
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.