Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / DevOps / deployment

OneClick Publishing Across Domains Using FTP

0.00/5 (No votes)
30 May 2011CPOL1 min read 14.6K  
Details on how to use OneClick publishing in VS2010 to build and publish across domains using FTP or FTP with SSL.

Background


OneClick deployment and publishing is great because it provides an automatic update feature that refreshes thick client application installs at intervals or startup as new builds become available. However, one of the main drawbacks to this technology has been that there is no easy user interface to publish across domains over FTP because of the credentials required. At first glance, this seriously limits build automation through MSBuild and/or Team Foundation Server 2010. However, with a little negotiation, it is easy to pass domain credentials into the publish FTP server path.



Where do you want to publish this application?


Regardless of if you are using MSBuild for later automation, it is nice to have single-click publishing to FTP from the IDE without a login prompt. Also, you should test your FTP publish location using OneClick publishing found under the VS2010 Build, Publish [Application Name] menu before deciding on automation methods.


So where it says "Specify the location to publish this application", you might enter the FTP URL with full credentials:


ftp://Domain_Name\UserName:PassWord@FTPServerNameOrIPAddress:PortNumber/Directory

The problem is that when you do this, you will encounter an error which says Invalid value for 'Publish URL': The given path's format is not supported.


The correct 'Publish URL' FTP syntax


Don't panic, the reason for this error is because the publishing engine does not know how to escape the URL. You must create a function to do this (e.g., new uri("FTP URL").toString()) or manually escape the backslash between the domain and the login name:


ftp://Domain_Name%5CUserName:PassWord@FTPServerNameOrIPAddress:PortNumber/Directory/

Conclusion


I think it is strange that the OneClick wizard does not have an interface for impersonation credentials and MSBuild seems to hide this functionality. You would think that this would be a core OneClick feature, but that's okay because you have this article in the interim.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)