How to access artifacts folder after build in TFS online?

Sturla picture Sturla · Jan 31, 2017 · Viewed 36.3k times · Source

PreInfo: I have .net core web api (vs2015) mixed with just ordinary projects.

I have spent almost 2 days now to get this to work and search and tried everything I can think of, but I just cant for the live of me get the build and release in TFS online to play together.

The build (publish artifact step) says "Directory 'D:\a\1\a' is empty. Nothing will be added to build artifact 'drop'."

but the "run dot net" step says

"Published to D:\a\1\s\Operator\MobileService\root\MobileService\src\AMP.Operator.MobileService\bin\release\net452\win7-x64\publish"

...so it must be somewhere the release can pick it up but no matter what I try I can´t get it to be picked up.

Here is my build setup My build

dotnet run dotnet run

publishing the publish

And the realse with $(System.DefaultWorkingDirectory)/MobileService-Dev please note that I have tried every combo of $(build.artifactstagingdirectory) in the build to publish without luck but I sure this should point to the publishing folder for the build realse

I so hope somebody can point me to a solution. I just can´t understand how hard it is to make this work..

Answer

Matt picture Matt · Jan 31, 2017

Within your build definition, I recommend adding a Copy Files step that will copy your the build artifacts from your msbuild results to the Build's Artifact Staging Directory before you run the Publish Artifact step.

  • Source Folder: $(Build.SourcesDirectory)
  • Contents: **\bin\$(BuildConfiguration)\**
  • Target Folder: $(Build.ArtifactStagingDirectory)

Copy Files Task

I am assuming that the $(BuildConfiguration) variable is custom to your definition and is probably Debug or Release. I am not sure what exactly the Run dotnet step does, but this build definition I setup published my build artifacts correctly. The Publish Build Artifacts step I'm running has the same steps as yours, except the only control option enabled is Enabled.

I am also running on TFS 2015 update 2.