Visual Studio Release Management: Trigger Release from TFS Build
To enable triggering a release in Visual Studio Release Management from TFS build requires few configuration steps to be performed.
Steps
Release template
First step is to allow triggering a release in the Release Template. This can be done in release template properties.
http://lh3.ggpht.com/-rmgpLD0KOOc/VHIK5TcnNGI/AAAAAAAADQg/4vLI5S1rYi0/001_thumb%5B1%5D.png
Select “Can Trigger a Release from a Build?” option.
http://lh4.ggpht.com/-ENd8L1KBnC8/VHIK7MBd7mI/AAAAAAAADQw/lHrY-MO3S7Q/002_thumb%5B1%5D.png
Change TFS Build template
Next step is to change the TFS build template to Special Template capable of triggering a release. If there is customized build template being used currently, it is possible to change it to support triggering a release. How to do that explained in below link.
http://lh5.ggpht.com/-fOH8sQMQQ2g/VHIK88ljdBI/AAAAAAAADRA/bA2-NhOBiiE/003_thumb%25255B1%25255D.png
http://lh5.ggpht.com/-uHQ7Njoi1f4/VHIK-zPHhOI/AAAAAAAADRQ/WP-itB-Krao/004_thumb%25255B1%25255D.png
If default build template is used as shown above, change it to template available with Release Management Client. This can be found at below shown location of a Release management Client installed machine.
http://lh3.ggpht.com/-69pys-ST89c/VHILAyK9BJI/AAAAAAAADRg/M2xxTOSwCSk/005_thumb%5B1%5D.png
Add ReleaseTfvcTemplate.12 to build process templates and select it as the build template in the build definition. If TFS 2012 ReleaseDefaultTemplate.11.1 should be used. If Git is used as source control repository ReleaseGitTemplate is available.
http://lh3.ggpht.com/-u6jsyVknnes/VHILCs_CRhI/AAAAAAAADRw/lXCRBgEaTjE/006_thumb%25255B1%25255D.png
http://lh3.ggpht.com/-D0fvUCNW4Y0/VHILET5zBwI/AAAAAAAADSA/N9yYhNKrVNA/007_thumb%25255B1%25255D.png
http://lh6.ggpht.com/-V8Kb-SDm0QA/VHILGFUzgNI/AAAAAAAADSQ/jzxJq2hzKSQ/008_thumb%25255B1%25255D.png
This template has a category for Release.
http://lh6.ggpht.com/-vT5Wwdbul1M/VHILIZjm1kI/AAAAAAAADSg/MD1me22OQks/009_thumb%25255B1%25255D.png
Set Release Build to true.
http://lh6.ggpht.com/-p6Hm9J6ctl8/VHILKYgGDlI/AAAAAAAADSw/_I51_eaaOGI/010_thumb%25255B1%25255D.png
To demonstrate the release with TFS build, below simple ASP.Net web application is altered with a simple change and tested in Development environment.
http://lh5.ggpht.com/-R5SA73Unyyw/VHILMcwldHI/AAAAAAAADTA/jbi5MVeYUok/012_thumb%25255B1%25255D.png
http://lh4.ggpht.com/-Z3X8cb2kLak/VHILOt4rBmI/AAAAAAAADTQ/a0t8lvfyU18/013_thumb%25255B1%25255D.png
The depsvr which is configured to deployed using VS Release Management still has old version and development (localhost) shows the change,
http://lh6.ggpht.com/-4gQfG2fgi2c/VHILQiVtjII/AAAAAAAADTg/uq7-iwdQweE/014_thumb%25255B1%25255D.png
Check in the change.
http://lh3.ggpht.com/-ex_YU1dVHTU/VHILTBCE2CI/AAAAAAAADTw/EBu-S0ec_O4/015_thumb%25255B1%25255D.png
CI build (Build each check in) is successful.
http://lh3.ggpht.com/-Us1Cyw-NeUo/VHILVV2LzVI/AAAAAAAADUA/LQEHWm62Iq0/016_thumb%25255B2%25255D.png
Trigger build
Next step is to trigger a build with output and initiate a release via that build.
http://lh4.ggpht.com/-AFC1HEAT-cg/VHILXtDThEI/AAAAAAAADUQ/DtypCcHz6eI/017_thumb%25255B1%25255D.png
http://lh6.ggpht.com/-BuMkgiSbzSk/VHILZ7wQgKI/AAAAAAAADUg/kq40s1nc0mM/018_thumb%25255B1%25255D.png
Wait for release to be triggered with the TFS build.
http://lh6.ggpht.com/-3ShY6rrYor0/VHILbwQk2oI/AAAAAAAADUw/NQ2sIkvkkb0/019_thumb%25255B1%25255D.png
New release is not triggered and Build failed with “Build service account needs to be a system user in Release Management Server”.
http://lh6.ggpht.com/-7Oa5moo-NVY/VHILffHGRcI/AAAAAAAADVA/AgHlHEQjk3M/020_thumb%25255B2%25255D.png
http://lh4.ggpht.com/-p2lvSggOS3I/VHILjsxH6hI/AAAAAAAADVQ/zbwYm-_ioGc/021_thumb%25255B2%25255D.png
Add the TFS Build Service account as a service account in Release Management.
http://lh3.ggpht.com/-eYUu8OBh4gg/VHILlt2yB8I/AAAAAAAADVg/tI1Kly5sqAQ/022_thumb%25255B1%25255D.png
http://lh4.ggpht.com/-cIlRUjozUHk/VHILnUIIgqI/AAAAAAAADVw/lrdS4uX3nEg/023_thumb%25255B1%25255D.png
http://lh3.ggpht.com/-2_WWRV3t0qk/VHILo6wZ9BI/AAAAAAAADWA/sJInumfLfLc/024_thumb%25255B3%25255D.png .
Retry Build.
http://lh3.ggpht.com/-KsUN6rZVGoc/VHILrdBzPQI/AAAAAAAADWQ/ry_xGmWthPQ/025_thumb%25255B1%25255D.png
Second attempt failed with same error.
http://lh4.ggpht.com/-JUtK6kdmbfs/VHILt6Wqj4I/AAAAAAAADWg/1gH7-wjN7xY/027_thumb%25255B1%25255D.png
http://lh4.ggpht.com/-mP9Qui164HQ/VHILwd70cKI/AAAAAAAADWw/SqdotnnzzjQ/028_thumb%25255B2%25255D.png
Hint
The Q&A in below link gives a hint.
Hint is the build server needs to be installed with Release Management Client and configured to access Release Management Server.
http://lh3.ggpht.com/-XfGHoiGu_uc/VHILyNZIjAI/AAAAAAAADXA/qlqKpU8GOZU/030_thumb%25255B1%25255D.png
http://lh3.ggpht.com/-w7Knq9_4x2M/VHILz4xFz7I/AAAAAAAADXQ/H-i1GLpne-k/031_thumb%25255B1%25255D.png
http://lh3.ggpht.com/-QUtogN4oMEc/VHIL1soq5iI/AAAAAAAADXg/TscoA0BK19U/032_thumb%25255B3%25255D.png
http://lh3.ggpht.com/-sqZccazLXzU/VHIL3ipujNI/AAAAAAAADXw/fXvEsZKJbU8/033_thumb%25255B3%25255D.png
Next attempt of the build successfully triggers the release in Release Management Server.
http://lh5.ggpht.com/-pzR2Sf5sbHo/VHIL5kBQK5I/AAAAAAAADYA/OFi1fOktcXg/034_thumb%25255B1%25255D.png
http://lh3.ggpht.com/-ivR-FgKpEW8/VHIL7c2jXkI/AAAAAAAADYQ/rHqtZKhusfs/035_thumb%25255B1%25255D.png
Acceptance Deployment step should be set to automated in release path of Release triggered by a TFS Build.
http://lh4.ggpht.com/-Rh03Z5Pe8I4/VHIL8x86WdI/AAAAAAAADYg/xR3sfYOS_lg/036_thumb%25255B1%25255D.png
Build succeeds and Release succeeds.
http://lh3.ggpht.com/-bT-_twOTGu8/VHIL-pZe_BI/AAAAAAAADYw/efoj06_Iu8M/037_thumb%25255B1%25255D.png
http://lh4.ggpht.com/-LWwGmAdsAdA/VHIMAQ-UmGI/AAAAAAAADZA/CkfHS_FjoE8/038_thumb%25255B1%25255D.png
DepSvr is updated with the change in the Demo web application.
http://lh3.ggpht.com/-p4ANassFnc0/VHIMB_tJc0I/AAAAAAAADZQ/vHDbs_lagC0/039_thumb%25255B1%25255D.png