0

I have successfully upgraded to VS/TFS 2017, and I am at the point where I want the build to automatically publish a website to a staging location using one of the project's publish profiles. I am impressed with the flexibility in the "Build & Release" section of the TFS Team Project Site, but it's a little overwhelming.

This project has 2 simple publish profiles. Both use the 'FTP publish method' to upload to the Go Daddy hosting provider; one deletes all files before upload, the other only updates files. There are transforms applied for things like connection strings. These publish profiles work properly. I just need them to be added at the end of an automated build.

It would seem it should be simple to say 'use this publish profile', but there are so many options and choices it's not intuitively obvious which to use, and I haven't been able to find a reference on the web that focuses on what I want to do.

Daniel Mann
  • 57,011
  • 13
  • 100
  • 120
Alan
  • 1,587
  • 3
  • 23
  • 43
  • How do you want to invoke the publish profile? Do you mean that you want to invoke the msbuild command using the publish profile to publish to FTP site? If it is, then it's impossible as FTP publishing is not supported on the command line. – Andy Li-MSFT Sep 28 '17 at 06:45
  • To answer your question, I'm not married to invoking the publishing profile in any specific way, I just wanted to invoke it in some way - automatically. It seems like the publishing profile machinery is already setup to do exactly what is needed - all it takes is a right click, publish and go. As you'll see from my comment below, I was under the mistaken impression the newer 2017 applications added a mechanism to simply engage those profiles already setup, thereby using what is already working. I'll use your answer below and get back to this. – Alan Sep 28 '17 at 12:27
  • @Alan right click and go you mean using the visual studio to publish the application based on that profile no? Do you just want to publish the page with a specific method? – Zinov Sep 29 '17 at 16:32
  • @Zinov Sorry for delayed response - on vacation. To answer your query, I really want to invoke on the build server the build of a website and have that build end up with an automatic publish to the staging host server. As I commented below, it became clear I simply need to dig into msBuild so I can add the appropriate commands to cause my desired outcome, not with standing additional advice you may have for me. – Alan Oct 11 '17 at 19:44
  • @Alan, for doing that you need to have of course the basics of MSBuilds, but it will serve you just for compile purposes. At the time of the Deployment, I think you should use tfs's task for completing the publish as you want – Zinov Oct 12 '17 at 20:20

1 Answers1

1

If you want to invoke the msbuild command using the publish profile to publish website to FTP location, then it's impossible as FTP publishing is not supported on the command line.

If you insist on invoking the publish profile, then you can invoke msbuild command line with the publish profile used to publish the website to a staging location (eg, local or UNC path), then use FTP upload task step to upload the website from the staging location to the specific FTP location, or using PowerShell script to upload the website.

You can reference this thread: How can I add FTP website deployment to a VS2015/TFS2013 build process

Andy Li-MSFT
  • 28,712
  • 2
  • 33
  • 55
  • Wow, the post you referenced was the post, along with others, that convinced me to upgrade my system from VS2015/TFS2013 to 2017. It just seemed like what I want to do would be too brittle with the old combination and that the 2017 system was more robust and better suited to setting up this process. I must have misunderstood you and others. I will revisit that post to setup what I want to do. I'll get back to this post after I've worked on it a bit. – Alan Sep 28 '17 at 12:23
  • I set this as the answer as I now understand what you are (& were previously) saying. I am convinced part of my problem is an MSBuild knowledge deficit, so I will be getting a book. But apart from creating the MSBuild I also need to set it up on the build server. Can you point me to a URL or other resource that shows how to integrate MSBuild on a TFS2017 build server? My builds are currently successful w/o any other actions; I just don't quite see how I integrate the actions you've outlined above (per your answer, I will NOT be using the publish profiles) – Alan Sep 28 '17 at 19:36
  • I thought I would follow-up to report success - finally! I used your link from the other SO post referenced above to the [David Kittle site](https://www.kittell.net/code/powershell-ftp-upload-directory-sub-directories/). His code seemed the most efficient for the current day. And it fit nicely into a Power Shell Task in the Build Definition. I will be making a few more posts to ask for help refining the CI automation, but your guidance was instrumental in getting me to this point. Thx! – Alan Oct 19 '17 at 19:40