Search code examples
azure-devops-self-hosted-agent

Why are there no files in my release artifacts directory?


I created a .netcore 2.1 api project and set up Azure DevOps to deploy it to an On-Prem computer using the Windows Agent.

api project files

The folder agent_work\r1\a was created on the machine running the agent, however there are no files in it.

I can see that a build did occur and that there is an artifact in my release

enter image description here

What did I miss doing?

[Update]

I can see in the agent job, there is a section which is about downloading an artifact.

It has the error message

There is no build available or the source is not accessible. You can select all artifacts or specify the list of artifacts to be downloaded below.

[Update]

Looks like I need to add a task to the job that is in a stage of my release. And that task needs to copy the files I want to deploy.

Now the problem is knowing how to specify the source folder. the copy files task

The strange thing is that it allows me to select a location and then rejects the selected location

location selection

There is help that says that if I leave the source folder empty, that will indicate the root of the repo. If I do this the deploy does not error but no files are deployed.

[Update] I can see in the Get Sources of the Build the message "YOu are in 'detached Head' state. Maybe this has something to do with the problem.

[Update] In the build pipeline I have the build

[Update]

When I try to create a new build pipeline I get the following

wizard screen

I select the location to be Azure Repos and the Repository to be vste then I the azure-pipelines.yml auto-generates as

# ASP.NET Core
# Build and test ASP.NET Core web applications targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://learn.microsoft.com/vsts/pipelines/languages/dotnet-core

pool:
  vmImage: 'Ubuntu 16.04'

variables:
  buildConfiguration: 'Release'

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

[Update]

Looks like I might need to select Use The Visual Designer

use the visual designer

[Update] From ollifant's comment I have found the Publish Artifact task. Now to figure out how to populate it the publish artifact task

[Update] Uh Uh not looking great nothing will be added


Solution

  • I had not used the ASP NET Core (.NET framework) template when creating the agent job in the build template, so the project was not building correctly.

    New build pipeline -> Use the visual designer -> Continue -> ASP.NET Core (.Net Framework)