1
votes

I have a command-line client written C# targeting .net core 2.2 (not an asp.net core, just a command-line app).

I'm trying to distribute that application to a group of servers using Azure DevOps pipelines.

Unfortunately, I cannot get the Visual Studio build action to create a complete package.

To deploy using the locally compiled package, I create a publish "Folder" profile that works fine. I hoped to be able to tell the action to do the same and copy the result to the Artifact Staging directory but, unfortunately, it does not seems to work.

I'm using the following MSBuild arguments:

/p:SkipInvalidConfigurations=true /p:DeployOnBuild=true /p:PublishProfile="FolderProfile"

The profile is defined as such:

<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121. 
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <PublishProtocol>FileSystem</PublishProtocol>
    <Configuration>Release</Configuration>
    <Platform>Any CPU</Platform>
    <TargetFramework>netcoreapp2.2</TargetFramework>
    <PublishDir>..\ClientPublish\</PublishDir>
    <SelfContained>false</SelfContained>
    <_IsPortable>true</_IsPortable>
  </PropertyGroup>
</Project>

From what I can see in the compilation log, the "DeployOnBuild" parameter is simply ignored and the application is never deployed.

What am I doing wrong ?

Edit

Here is a screenshot of my most recent attempt using a deployment profile: enter image description here

Copy file: enter image description here And artifact publish: enter image description here

Alternatively, I tried it like this after disabling the file copy task:

enter image description here

1
try these: /p:DeployOnBuild=true /p:WebPublishMethod=FileSystem /p:DeployDefaultTarget=WebPublish /p:publishUrl="$(build.artifactstagingdirectory)\\" Especially the last oneJabberwocky
Also, do you have a publish artifact task in the end?Jabberwocky
I have a publish artifact yet and before that, I had a file copy operation that copied the ..\ClientPublish\ into $(build.artifactstagingdirectory) but since there is no publish triggered, the source folder stays emptyStephane
I tried it with the parameters you suggested but no luck: the build succeeds but I get "2019-01-31T18:34:09.8644830Z ##[warning]Directory 'D:\a\1\a' is empty. Nothing will be added to build artifact 'drop_client'." and, of course, nothing to deployStephane
I'm home now but I can guide you through tomorrow that I'll be at work and will have my builds in front of me.Jabberwocky

1 Answers

1
votes

After a lot of back and forth this is the correct pipeline for it to work:

enter image description here

SDK Installer task first (Similar to Nuget Installer for .NET Framework)

.dotnet restore (similar to Nuget Restore for .NET Framework)

Build Solution

And then add .dotnet publish to create an artifact (This step needs to be added after the build)

Publish Artifact to drop the artifact for the release pipeline to pick up.

Seems like MSBuild arguments are not needed in this case. The built in pipelines will do everything on their own.