Q:

WebSite deploy with on-premises TFS to IIS

For a last seven days I'm working/playing with TFS on-premises in my company and trying to make auto build and deployment to work but somehow I can't find any source on internet how to do that.  Every tutorial is about Visual Studio Team Services (was TFS Online).  
Projects are building fine, but facing problem with deployment.  
I get lost with all of these steps "Copy files", Pulbish Artifacts etc. 
Maybe somebody knows something about this or have link to article? 

A:

You can use the Build Argument to build and deploy the code to a server.  See a sample build argument below:
/p:MSDeployServiceUrl=<SERVERNAME> /p:DeployIisAppPath=<IISPATH> /p:UserName=<USERNAME> /p:Password=<PASSWORD> /p:DeployOnBuild=True /P:AllowUntrustedCertificate=True /p:DeployTarget=MsDeployPublish /p:CreatePackageOnPublish=True /p:MSDeployPublishMethod=WMSVC /p:TransformConfigFiles=true /p:EnableMSDeployBackup=true

Also, to enable the webdeploy in the server, you will have to do as below:

Install Web Platform Installer in the server
https://www.microsoft.com/web/downloads/platform.aspx
Using the web plat form installer, install the below softwares:

WebDeploy 3.6
Windows Management Service (if not installed already)

Open IIS, from the IIS Home, select -> Management Service
In the Windows Management Service, 

Select the option -> Enable Remote Connections
Select the option -> Identity Credentials as “Windows Credentials or IIS Manager credentials”
Now, click on Apply
Start the service

Now from IIS Home, goto -> IIS Manager User

Create a new User and assign a password

Goto the individual website Home (website to which the deployment needs to happen), goto -> IIS Manager Permissions and add the above user using the Allow User option.  This needs to be done for all the websites that are required to be enabled for TFS build and Deployment
Now, right click on each of the websites and click Edit Permissions.  Add the User -> LOCAL SERVICE to the list of users with full permission
Now, goto IIS Home and then select -> Configuration Editor

Select section -> system.webServer/wdeploy/backup from the list
Enter the backupPath.  This will be the path when the backups will be kept before deploying
Select the setting -> enabled as True
Select the setting -> turnedOn as True
Select the numberOfBackups 
Now click on Apply

