3

Did any got a working Build Definition in Azure DevOps working for nopCommerce 4.xx working? If so will you please share the YAML-file. I tried several possible solutions, but I don't get it work.

I used the default ASP.NET Core template from Azure Devops. See below YAML

content: resources:
- repo: self queue:   name: Hosted Ubuntu 1604

steps:
- task: DotNetCoreCLI@2   displayName: Restore   inputs:
    command: restore

   projects: '$(Parameters.RestoreBuildProjects)'


- task: DotNetCoreCLI@2   displayName: Build   inputs:
    projects: '$(Parameters.RestoreBuildProjects)'

    arguments: '--configuration $(BuildConfiguration)'


- task: DotNetCoreCLI@2   displayName: Test   inputs:
    command: test

    projects: '$(Parameters.TestProjects)'

    arguments: '--configuration $(BuildConfiguration)'


- task: DotNetCoreCLI@2   displayName: Publish   inputs:
    command: publish

    publishWebProjects: True

    arguments: '--configuration $(BuildConfiguration) --output $(build.artifactstagingdirectory)'

    zipAfterPublish: True


- task: PublishBuildArtifacts@1   displayName: 'Publish Artifact'   inputs:
    PathtoPublish: '$(build.artifactstagingdirectory)'

At the Build step it gives errors when trying to build the Plugins:

2018-12-16T20:31:51.2431313Z /home/vsts/work/1/s/src/Build/ClearPluginAssemblies.proj(21,5): error MSB3073: The command "dotnet "/home/vsts/work/1/s/src/Build\ClearPluginAssemblies.dll" "OutputPath=/home/vsts/work/1/s/src/Build/../Presentation/Nop.Web/bin/Release/netcoreapp2.1/|PluginPath=/home/vsts/work/1/s/src/Plugins/Nop.Plugin.DiscountRules.CustomerRoles/../../Presentation/Nop.Web/Plugins/DiscountRules.CustomerRoles/|SaveLocalesFolders="" exited with code 1.

Anyone an idea how to get this working?

Edit: The response of Eriawan give me some insight to look further. I investigated the csproj files of one of the Plugins and see there the next section:

Thank you for your response. It took me closer to the root cause of the problem (hopefully). I investigated one of the csproj file of the PlugIns of nopCommerce and I see the following section

<!-- This target execute after "Build" target -->
<Target Name="NopTarget" AfterTargets="Build">
<!-- Delete unnecessary libraries from plugins path -->
<MSBuild Projects="$(MSBuildProjectDirectory)\..\..\Build\ClearPluginAssemblies.proj" Properties="PluginPath=$(MSBuildProjectDirectory)\$(OutDir)" Targets="NopClear" />
</Target>

Is there a way to turn off these extra execution during build? or to get this work during build, without adjust the csproj file (because I want to adopt future changes of the project)?

Sven
  • 195
  • 2
  • 11

1 Answers1

0

If you are using YAML as option for your Azure Pipelines, you should pay attention to the sequence for the build. Also don't mix YAML with build definition, because YAML is different from the old build definition used by TFS and VSTS (before it changed name to be Azure DevOps).

Looking at the YAML, you should have a full build on your DotNetCoreCLI@2 task, by executing command build. The error you have is a little bit cryptic, but it shows that you just execute dll directly and this means you are going to execute the dll instead of doing actual build.

So instead of this:

- task: DotNetCoreCLI@2   
  displayName: Build   
  inputs:
    projects: '$(Parameters.RestoreBuildProjects)'
    arguments: '--configuration $(BuildConfiguration)'

It should be this:

- task: DotNetCoreCLI@2   
  displayName: Build   
  command: build
  inputs:
    projects: '$(Parameters.RestoreBuildProjects)'
    arguments: '--configuration $(BuildConfiguration)'

Notice the additional command: build.

Eriawan Kusumawardhono
  • 4,796
  • 4
  • 46
  • 49