4.3 - Couple of issues when building source code on Azure DevOps build pipeline

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
3 years ago
I'm working on setting up an Azure DevOps build pipeline for 4.3 source code.

I noted a couple of issues and workarounds, which I'd like to share to community and nopCommerce team.
My pipeline YAML is:

# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core

trigger:
- master

pool:
  vmImage: 'ubuntu-latest'

variables:
  buildConfiguration: 'Release'




steps:



- task: NuGetCommand@2
  inputs:
    command: 'restore'
    restoreSolution: '**/*.sln'
    feedsToUse: 'select'
    vstsFeed: '51754111-95b4-4136-bd32-52f73b12788e'

- script: dotnet build --configuration $(buildConfiguration)
  displayName: 'dotnet build $(buildConfiguration)'


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

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




1) Azure DevOps build Task fails on Nop.Plugin.Tax.Avalara plugin

The build agent behind the scenes is a Linux VM. Not sure it this makes a difference. The source code compiles fine on my local windows box.

Build FAILED.



Controllers/TaxTransactionLogController.cs(6,37): error CS0234: The type or namespace name 'Log' does not exist in the namespace 'Nop.Plugin.Tax.Avalara.Models' (are you missing an assembly reference?) [/home/vsts/work/1/s/Plugins/Nop.Plugin.Tax.Avalara/Nop.Plugin.Tax.Avalara.csproj]

Models/Configuration/ConfigurationModel.cs(4,37): error CS0234: The type or namespace name 'Log' does not exist in the namespace 'Nop.Plugin.Tax.Avalara.Models' (are you missing an assembly reference?) [/home/vsts/work/1/s/Plugins/Nop.Plugin.Tax.Avalara/Nop.Plugin.Tax.Avalara.csproj]

Models/Configuration/ConfigurationModel.cs(63,16): error CS0246: The type or namespace name 'TaxTransactionLogSearchModel' could not be found (are you missing a using directive or an assembly reference?) [/home/vsts/work/1/s/Plugins/Nop.Plugin.Tax.Avalara/Nop.Plugin.Tax.Avalara.csproj]

Controllers/TaxTransactionLogController.cs(53,46): error CS0246: The type or namespace name 'TaxTransactionLogSearchModel' could not be found (are you missing a using directive or an assembly reference?) [/home/vsts/work/1/s/Plugins/Nop.Plugin.Tax.Avalara/Nop.Plugin.Tax.Avalara.csproj]

    0 Warning(s)

    4 Error(s)



Time Elapsed 00:01:38.08



##[error]Bash exited with code '1'.

Finishing: dotnet build Release


Workaround:  REMOVE Avalara plugin from solution, and rebuild.


2)  Azure DevOps PUBLISH Task fails with error NU1605: Detected package downgrade: System.Net.NameResolution from 4.3.0 to 4.0.0. Reference the package directly from the project to select a different version

full error:

2020-05-20T15:59:18.8557611Z ##[section]Starting: Publish
2020-05-20T15:59:18.8571440Z ==============================================================================
2020-05-20T15:59:18.8571757Z Task         : .NET Core
2020-05-20T15:59:18.8572086Z Description  : Build, test, package, or publish a dotnet application, or run a custom dotnet command
2020-05-20T15:59:18.8572413Z Version      : 2.169.1
2020-05-20T15:59:18.8572753Z Author       : Microsoft Corporation
2020-05-20T15:59:18.8573078Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli
2020-05-20T15:59:18.8573576Z ==============================================================================
2020-05-20T15:59:21.4234620Z [command]/usr/bin/dotnet publish /home/vsts/work/1/s/Presentation/Nop.Web/Nop.Web.csproj -r linux-x64 --configuration Release --output /home/vsts/work/1/a/Nop.Web
2020-05-20T15:59:21.5132079Z Microsoft (R) Build Engine version 16.5.0+d4cbfca49 for .NET Core
2020-05-20T15:59:21.5132818Z Copyright (C) Microsoft Corporation. All rights reserved.
2020-05-20T15:59:21.5133340Z
2020-05-20T15:59:27.2562525Z   Restore completed in 2.38 sec for /home/vsts/work/1/s/Libraries/Nop.Services/Nop.Services.csproj.
2020-05-20T15:59:27.2563858Z   Restore completed in 2.38 sec for /home/vsts/work/1/s/Presentation/Nop.Web.Framework/Nop.Web.Framework.csproj.
2020-05-20T15:59:27.7178404Z /home/vsts/work/1/s/Libraries/Nop.Data/Nop.Data.csproj : error NU1605: Detected package downgrade: System.Net.NameResolution from 4.3.0 to 4.0.0. Reference the package directly from the project to select a different version.  [/home/vsts/work/1/s/Presentation/Nop.Web/Nop.Web.csproj]
2020-05-20T15:59:27.7185033Z /home/vsts/work/1/s/Libraries/Nop.Data/Nop.Data.csproj : error NU1605:  Nop.Data -> MySql.Data 8.0.20 -> SSH.NET 2016.1.0 -> System.Net.Sockets 4.1.0 -> runtime.unix.System.Net.Sockets 4.3.0 -> System.Net.NameResolution (>= 4.3.0)  [/home/vsts/work/1/s/Presentation/Nop.Web/Nop.Web.csproj]
2020-05-20T15:59:27.7188792Z /home/vsts/work/1/s/Libraries/Nop.Data/Nop.Data.csproj : error NU1605:  Nop.Data -> MySql.Data 8.0.20 -> SSH.NET 2016.1.0 -> System.Net.NameResolution (>= 4.0.0) [/home/vsts/work/1/s/Presentation/Nop.Web/Nop.Web.csproj]
2020-05-20T15:59:27.7699775Z   Restore failed in 486.77 ms for /home/vsts/work/1/s/Libraries/Nop.Data/Nop.Data.csproj.
2020-05-20T15:59:28.2342983Z   Restore completed in 362.09 ms for /home/vsts/work/1/s/Libraries/Nop.Core/Nop.Core.csproj.
2020-05-20T15:59:30.4544524Z   Restore completed in 3.17 sec for /home/vsts/work/1/s/Presentation/Nop.Web/Nop.Web.csproj.
2020-05-20T15:59:30.5086088Z ##[error]Error: The process '/usr/bin/dotnet' failed with exit code 1
2020-05-20T15:59:30.5101205Z ##[warning]Info: Azure Pipelines hosted agents have been updated to contain .Net Core 3.x (3.0 and 3.1) SDK/Runtime along with 2.1. Unless you have locked down a SDK version for your project(s), 3.x SDK might be picked up which might have breaking behavior as compared to previous versions.
Some commonly encountered changes are:
If you're using `Publish` command with -o or --Output argument, you will see that the output folder is now being created at root directory rather than Project File's directory. To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting
2020-05-20T15:59:30.5104706Z ##[error]Dotnet command failed with non-zero exit code on the following projects : /home/vsts/work/1/s/Presentation/Nop.Web/Nop.Web.csproj
2020-05-20T15:59:30.5132518Z ##[section]Finishing: Publish


WORKAROUND: In Nop.Data project, Update System.Net.Sockets  and System.Net.NameResolution to 4.3.0 and rebuild

With these two workarounds, I now have a working end-to-end pipelines for Build, and Release to my deployment group of Linux web servers.


Jon

3 years ago
Update on the above...

Issue #1 - this was due to the /Views/Log and /Models/Log content being excluded by the VS git ignore file. Added these to source control, and re-ran build pipeline on Azure DevOps. - All good.
3 years ago
Hi JonQuick,
I also deployed my nopcommerce using Azure. I have my repo in GitHub and import it in DevOps.
There's a lot of error in the previous version when deploying in DevOps like the one you posted. But I think in the latest version everything seems perfect for me. I haven't tried editing my source code yet.

My question is, have you already edited your code and redeploy with no errors when building it using DevOps ?
3 years ago
Hi leafarafael,

my only concern remaining is the  dependency version mis-match when  executing the publish action on Azure DevOps pipeline with error:

"PUBLISH Task fails with error NU1605: Detected package downgrade: System.Net.NameResolution from 4.3.0 to 4.0.0"

as I mentioned in my last post, to work around this I manually adding System.Net.NameResolution v4.3.0 package to the Nop.Data project and then rebuilding on DevOps resolved this.  Did you see the same issue? or maybe this is something odd in my build?

In answer to your question:  Yes, I have modified the code/projects (I added a test custom plugin). Then pushed to Devops Git repository. It automatically rebuilt with no issues at all.

Are you deploying to azure webapps? I have yet to try this . I deploy to my own Linux VPS (using Copy files over SSH, and SSH cmd to unzip and reset permissions on artifacts copied across)

Jon
3 years ago
Hi,
yes same here, it's the linux publishing issue, got the same error on clean publish, your fix did the trick and it works

dotnet publish 4.3\Presentation\Nop.Web\Nop.Web.csproj -o .\publish -c Release -r linux-x64 --self-contained true

thanks
3 years ago
Downloaded latest 4.3 source code, it has been fixed,
publish works without any issues.

Thanks
3 years ago
nosik wrote:
Downloaded latest 4.3 source code, it has been fixed,
publish works without any issues.

Thanks


Yep, same here - clean build now with the updated official downloads
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.