DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. SimpleDeploy.Net - An FTP Style Wrapper for the MS Deploy API

SimpleDeploy.Net - An FTP Style Wrapper for the MS Deploy API

Douglas Rathbone user avatar by
Douglas Rathbone
·
Jan. 08, 13 · Interview
Like (0)
Save
Tweet
Share
4.15K Views

Join the DZone community and get the full member experience.

Join For Free

ms deploy is such a powerful tool when used to keep your applications and services up to date. what is even more awesome is that the api for ms deploy is available for you to write applications that utilise this power from within your own applications. as most people who’ve played with ms deploy can report though, whether you’re using msbuild, powershell or the .net api; the ms deploy api sucks when it comes to simplicity. so after trial and error and much head banging i’ve created a wrapper for ms deploy’s api to help you complete simple tasks with less friction.

image i've spent a fair bit of my personal time working on a personal project that i'll be releasing in the next few months. it involves the use of the ms deploy api for deployment. i’ve had to get very close to the api that ms deploy makes available, and in doing so have come to have a love/hate relationship with how it has been written.

ms deploy contains a very powerful toolset but file upload and download is definitely only the tip of iceberg of this functionality. this is my problem. the team who wrote the api appears to have been so involved with the bigger problems, that the act of simply uploading a file to a remote server is a painfully long winded and hard to understand task:

ms deploy api upload example:

var destinationoptions = new deploymentbaseoptions
{
    computername = "https://myserver.com:8172/msdeploy.axd?site=[myiiswebsitename]",
    username = "myusername",
    password = "myoobersecurepassword",
    usedelegation = true,
    authenticationtype = "basic"
};

var syncoptions = new deploymentsyncoptions { donotdelete = true };

var remotepath = string.format("{0}/{1}", "[myiiswebsitename", "theremotefilepathtosaveto.txt");

using (var localfile = deploymentmanager.createobject(deploymentwellknownprovider.contentpath, @"c:\temp\filetoupload.txt"))
{
    var result = localfile.syncto(deploymentwellknownprovider.contentpath, remotepath, destinationoptions, syncoptions);
    //if (result.objectsadded == 1 || result.objectsupdated == 1) everything has worked
}

welcome simpledeploy.net

so i took the liberty of making it easier for people like me who just want to freekin-upload-some-files . i haven’t looked back.

simplydeploy.net is a very simply library with 4 simple methods:

public deploymentobjectlist fetchfilelist(connectionproperties properties)
public bool downloadfile(connectionproperties properties, string relativeremotefilename, string fulllocalfilepathtosave)
public bool uploadfile(connectionproperties properties, string relativedestinationfilename, string fulllocalfilepath)
public bool deletefile(connectionproperties properties, string relativeremotefilename)

it uses the contentpath webdeploy provider to make all of its remote calls in keeping with visual studio 2012’s web deploy publishing profile support. hopefully this will allow for the most coverage from servers/sites that already support this.

getting it

it is released under ms-pl so is fine for commercial use.

either download the source from github - https://github.com/dougrathbone/simpledeploynet

or install using nuget:

image

File Transfer Protocol API

Published at DZone with permission of Douglas Rathbone, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Core Machine Learning Metrics
  • Why You Should Automate Code Reviews
  • How To Generate Code Coverage Report Using JaCoCo-Maven Plugin
  • Explainer: Building High Performing Data Product Platform

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: