-1

We were using xaml builds earlier now we migrated to TFS2017. I am not able to publish the build files and how can we copy them.

My Build runs file it does not publish files. I see only the code files.

2 Answers2

0

You need to add Copy Files task and Publish Build Artifacts task in your build definition, to copy and publish files:

enter image description here

Cece Dong - MSFT
  • 29,631
  • 1
  • 24
  • 39
  • Yes i have done the same as in the image below but its not generating but build completes successfully. – Sheikh Junaid Jan 19 '18 at 07:12
  • @SheikhJunaid How did you specify the arguments in task `Copy Files` and `Publish Build Artifacts`? Please check [this website](https://learn.microsoft.com/en-us/vsts/build-release/tasks/utility/copy-files) to specify appropriate arguments using match patterns. – Cece Dong - MSFT Jan 19 '18 at 07:27
  • @SheikhJunaid Please notice folders like Build.BinariesDirectory are reserved paths that you can use to override the default build outputs specified in the projects. The output of a build won't go into Build.BinariesDirectory by default. – Cece Dong - MSFT Jan 19 '18 at 07:40
  • What is the default path where i can look. Also What should be the change i need to make to publish binaries in a particular file. Later i can use copy files task to copy them to respective locations – Sheikh Junaid Jan 19 '18 at 11:54
  • If you run your project locally, where are the binaries going? – Cece Dong - MSFT Jan 22 '18 at 07:47
  • i created the profile and its creating the binaries there if i do manually on my local system – Sheikh Junaid Jan 22 '18 at 15:39
  • The location of variable $(Build.BinariesDirectory) on your build agent is C:\agent\_work\8\b, you could check this folder to see whether there is binaries. If they are not there, check folder C:\agent\_work\8\s, to see where they locate and share the path. – Cece Dong - MSFT Jan 23 '18 at 08:55
  • I checked both these paths on build controller server and both are empty. And having the code files likes as in TFS not the published files. – Sheikh Junaid Jan 23 '18 at 09:49
  • Is C:\agent_work\8\s empty? According to your log file, build agent get sources to this folder. You could queue another TFS build, and check where the source downloaded and check the files. – Cece Dong - MSFT Jan 24 '18 at 08:34
  • Yes this folder is having TFS Source files. But i dont see publish binaries getting generated anywhere. @Cece Dong – Sheikh Junaid Jan 25 '18 at 05:42
  • How about location like C:\agent_work\8\s\project\bin\Debug? – Cece Dong - MSFT Jan 25 '18 at 07:05
  • Not there as well.. I see code files under S\Project – Sheikh Junaid Jan 25 '18 at 08:59
  • So it seems your build doesn't generate binaries. Please try to build your project on your build agent machine with MSBuild command line, to see whether it generate binaries. – Cece Dong - MSFT Jan 25 '18 at 09:03
0

Maybe you may create the publish profile for you web project and use it in build process. I use this way for the web site project:

  1. Create the publish profile for project to package: https://msdn.microsoft.com/en-us/library/dd465323(v=vs.110).aspx
  2. Add publish args for the build step. In my case:

/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\Test" /p:PublishProfile="shdemowebtest - Web Deploy"

enter image description here

  1. Then copy drop artifact

In your case you may create profile to publish on the file system. Then add build args to publish and redirect the destination folder: MsBuild publish website without using publish profile

Steps for publish to local folder (on VSTS and local build agent):

  1. Add new profile to your project (destination bin\release\PublishOutput):

enter image description here

  1. I use first build step to build additional project with tests.

enter image description here

  1. Add step to publish with default folder path. MS Build Args:

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

enter image description here

3.1. Then I use standard step to copy results to staged directory:

enter image description here 3.2. And publish to drop artifact:

enter image description here 3.3. Then you can use that artifact to deploy with release management:

enter image description here

  1. Add step to publish to custom path: MS Build Args:

    /p:DeployOnBuild=true /p:PublishProfile="FolderProfile" /p:publishUrl="C:\temp\Output"

enter image description here

4.1. The result of this step:

enter image description here

Shamrai Aleksander
  • 13,096
  • 3
  • 24
  • 31
  • This is for VS2013 using the xaml. I need for vs2017 where the builds dont have the xaml and it failed when i tried to so these steps in command line as ms build arguments..Can you please add screenshots what i need to write on to get the binaries published. – Sheikh Junaid Jan 22 '18 at 06:05
  • Thanks. This was very helpful...I added same steps. I am getting this meesgaed now after Build completes C:\agent\_work\8\a' is empty. Nothing will be added to build artifact 'drop'. The Folders are empty. Is this folder on Build Server. Also why you have again solution build after files copy. Do i need to add it as well. Instead of Artifact publish location in your images i have artifact type which is having two option **Server** and **File Share** @Shamray Aleksander – Sheikh Junaid Jan 22 '18 at 15:23
  • "Also why you have again solution build after files copy". No. this is just example – Shamrai Aleksander Jan 22 '18 at 15:41
  • "i have artifact type which is having two option Server and File Share". My builds on Visual Studio Team Services. For TFS I also have **Server** and **File Share** – Shamrai Aleksander Jan 22 '18 at 15:44