1

I am setting up TFS 2015 for Build and deploy. I have got things working as I expect however I started to notice that the files being published in TFS do not look like the same files that were being published when I right-click and publich the project in Visual Studio (i.e. in VS my publication doesnt contain the .cs files etc..).

In TFS I have Build Steps:

  • Visual Studio Build enter image description here

  • Copy Files (to copy the build files to a staging directory) enter image description here

  • Publish Build Artifacts (going to File Share location I will then deploy from) enter image description here

I was rather hoping to see Web-Deploy/MSDeploy in the list of Build Steps (under Deploy).

Has anyone come across this and figured out what is going on? Please let me know if you need any more detail on my current configuration.

Thanks

**** EDIT ****

Okay, I have been learning a lot more about what I am expecting to see and it seems like I need my build to go through a PreCompile. From what i have read the project I am currently workign on is a WAP and is therefore precompiled as part of every publication. This moves the code (.cs files) into respective DLLs.

I have therefore started looking down the route of applying a Batch Script to initiate the ASP.NETs aspnet_compiler.exe to carry out the precompilation - but I am getting various errors relating to the web.config.

This is starting to become quite a pain for something I might expect to be quite simple for TFS Build..!! It is Microsoft afterall!

CJH
  • 1,266
  • 2
  • 27
  • 61
  • Could you add the detail build step `Copy FIles` and `Publish Build Artifacts` in the question? – PatrickLu-MSFT Sep 05 '16 at 10:01
  • Hi Patrick - I have added screenshots for each of the Tasks I have setup above. I have also added some more info under **** EDIT **** following further investigations my end. I am amazed that it seems so difficult to replicate the 'Right-Click > Publish' functionality in TFS Release Management...?! So much so I feel I must be missing something very basic?! – CJH Sep 05 '16 at 11:57

1 Answers1

0

In vNext build, to publish your build artifacts with the Copy files and Publish build artifacts steps. Try to use the local path on the agent where any artifacts are copied to before being pushed to their destination. For example:

  1. Add /p:DeployOnBuild=true /p:OutDir="$(build.artifactstagingdirectory)\" arguments in Visual Studio Build step;
  2. Change "Path to Publish" of Publish Build Artifacts task to $(build.artifactstagingdirectory)\_PublishedWebsites\ProjectName:
PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • 1
    I have just tried your example there and am getting build failures... I am guessing it is because I am building at the solution level instead of the Project level (I have added screenshots to my original question of how i have things setup). – CJH Sep 05 '16 at 11:53
  • You need to add `/p:DeployOnBuild=true /p:OutDir="$(build.artifactstagingdirectory)\\"` in your msbuild argurments and without the copy task. Since this will directly publish your build artifacts. Details pleas check the screenshot of build step with the answer from Eddie in this answer:http://stackoverflow.com/questions/38979398/how-do-i-get-the-the-expected-output-from-a-tfs-2015-build-to-match-my-xaml-bui/39011460#39011460. – PatrickLu-MSFT Sep 05 '16 at 12:07
  • 1
    That did the trick nicely thanks Patrick! How easy was that in the end...! Im glad I didnt need to start messing with the aspnet_compiler. – CJH Sep 05 '16 at 12:16
  • Just another quick one Patrick... Do you know the reason for the double backslash - and also on the Path to Publish - I dont seem to be able to find the sub directory \_PublishedErbSites\ProjectName... Is this a temporary folder created as part of the MSBuild in the previous task? I am basically trying to replicate this behavior in Jenkins now and am not getting too much success with outputting the files int he Compiled format. – CJH Sep 07 '16 at 09:53
  • Sorry, not delve into this why using "\\" there. As for `_PublisheErbSites\ProjectName` there is no this folder :). If you are meaning `_PublisheWebSites\ProjectName` this is a folder created by build agent. More details please take a look at this http://stackoverflow.com/questions/9097057/what-is-the-purpose-of-binaries-publishedwebsites-directory-under-tfs-build – PatrickLu-MSFT Sep 08 '16 at 09:49