Setting up TFS 2013
This will be similar to the article "Setting up TFS 2010", with differences for the new version.
Goal: Deploy a .NET 2013 solution containing 3 web applications and several code libraries to a development web server, using a build server with TFS installed (or use the development server as the build server).
I no longer have web sites, so I don't know how these instructions will work if you are using web sites (vs.applications).
Reason: Upgrade from TFS 2010
1. Install/Upgrade TFS 2013 Server on your build server. I chose Basic Installation, installed the server and the build tools. I put it on the development server as we don't have a separate build server available, but during the setup you will see a message saying this is not recommended as it may impact performance/security.
Verify visual studio can connect to TFS by selecting your build server in Team Explorer of a local copy of visual studio.
NOTE: Unlike TFS 2010, you must specify the collection name instead of just 'tfs' in the web path.
Make sure all visual studios are up to date with latest service packs and Team Explorer add on.
See my post titled 'Microsoft Fail' if you get connection errors.
2. Install "Web Deployment 3.0" package on your development server you want to push builds to. Otherwise TFS won't talk to it.
I think this is only needed if you have Web Applications (not web sites), but I'm not positive.
2.1 Install Management Service on IIS if it isn't already installed. Under Server Manager, click Roles, scroll down to IIS, and ensure this is installed. If not, use 'Add Role Service' to add the Management Service.
This is required in step 4 (web applications only)
2.2 Install Management Service Delegation on IIS if it isn't already installed.
Under Add/Remove Programs, select installed 'Web Deployment 3.0/3.5", right click-"Change", and ensure all features under IIS Deployment Handler are installed.
2.3 Add yourself as a user for web deploys on the IIS site you would like to build to; this will report the http path to use for the server connection.
For more info, see https://msdn.microsoft.com/en-us/library/dd465337(v=vs.110).aspx
3. On TFS server, TFS Admin Console, start the build configuration services using all defaults.
Make sure Visual Studio is installed on your build server or you may have to jump through hoops to get code to compile.
4. (Web Applications Only): On IIS dev server, click server name, go to Management Service, enable remote connections, and start the service. Under IIS Manager Permissions, add a Windows user who TFS will use to publish your websites.
I would recommend that you verify that you can manually publish a web deploy package before trying to get TFS to do it!
Publish Method: Web Deploy
Service URL: http://servername
Site/application: Default Web Site/MyApp (configure this manually and use correct name)
Credentials: The windows user you entered above
Uncheck all databases (unless you want to deploy them)
5. Now, try to get TFS to publish.
Team Explorer/Builds -> New Build Definition...
General: enter a name
Trigger: Manual (for testing) or Check-in/Rolling/Gated (once you're ready to go live)
Souce Settings: Ensure your project is checked in to source control and select the solution's source control folder
Workspace: use default
Build Defaults: Enter a drop folder; this is just a temporary working path like \\myserver\Web\TFS.
Configurations: Set to Any CPU|Debug
Output location: AsConfigured (uses project settings)
All other defaults are fine here, except you need to set your MSBuild Arguments if you have a web application (not web site). I used:
/p:DeployOnBuild=True /p:DeployTarget=MsDeployPublish /p:CreatePackageOnPublish=False /p:MSDeployPublishMethod=WMSVC /p:MSDeployServiceUrl=SERVERNAME /p:DeployIisAppPath="Default Web Site/WEBAPPNAME" /p:UserName=DOMAIN\USER /p:Password=PASSWORD /p:AllowUntrustedCertificate=True
Since the web application name is coded in here under DeployIisAppPath, this only works if you have one web application.
Multiple web projects (sites) are okay.
If you have multiple web applications, do not include the parameter "DeployIisAppPath". Instead, skip this parameter.
For each web application, right click on the project and click 'Properties".
Enter this path (Default Web Site/AppName) into the appropriate box on the Package/Publish Web tab.
These will be used for each project.
You can leave the MSBuild parameters blank if you're just compiling web sites (no .csproj file). Note that your project must be in a solution or the build task will not have valid defaults when you create it.
Retention Policy: leave defaults
6. Make sure all your third-party dlls are available to TFS to build. Add a solution-level folder such as "Libs" and drop them in there. Then in each of your projects, point to the dlls in this folder.
Ensure TFS didn't check in your dlls under the bin folder or you will have problem. Ensure your Libs folder is checked in or you will have problems.
7. Right click on the build and Queue Manual Build, then double click the build object to view the status.
If you are lucky, it will compile all code into the drop directory you configured. It will also copy your web application to IIS per your MSBuild parameters.
8. I have not tested how web sites (not applications) are handled in TFS 2013. In TFS 2010 you had to manually edit the task to move them from your drop folder to the actual live folder. Not sure if this is resolved in 2013.
Created By: amos 1/30/2014 4:51:12 PM
Updated: 7/20/2015 2:47:55 PM