Saturday, 14 February 2015

Upgrade Guide - VS Release Management Server - 2013.2 to 2013.4

This is a step by step guide to upgrade VS Release management Server from 2013.2 to the latest update 2013.4.
1. Backup
Take a backup of release management database is a must before running the upgrade. It will be the only option to recover from a failure in upgrade process.
1
2 
3

2. Backup config files of RM Service and RM Web.
It is important to take backup of cofig files of the RM Service and Web since there could be some special config changes made to these files while setting up RM Server initially.
4
5
Backups of config files.
6
As long as backup of Release Management database and config files available recovering from a failure upgrade would not be an issue.
3. Uninstall VS RM 2013.2 (Old version)
It would not be possible to install VS RM 2013.4 without uninstalling the previous version. Below error would be given in such attempt.
Uninstalling will not remove any of the previous release information or release templates, paths,  environment configurations etc. since all those details are available in release management database and the uninstall will not change/delete the release management database.
8

Uninstall release management client (If installed) in release management server machine.
9
10
12
Uninstall release management server.
13
14
15
16
17
Make sure release management server and client uninstalled in release management server machine.
18
4. Install Release Management Server 2013.4
19
20
21

Click launch in above screen loads the configuration window.
5. Configure release management server.
Test the rmservice account and release management url and click Apply Settings. Provide SQL server name of the server containing the existing(current) release management database
22
Create database will not create a new database. it will update the existing release management database.
23
24

6. Install release management client.
Install release management client in the release management server machine to mange it.
25
26
27
 28
7. Connect client to release management server.
Connect release management server to client and verify previous data availability.
29
Click Yes
30
Previous release details available.
31
TFS connection to release management active.
31_1
Release templates are available.
32
Release management website working.
33
Previously configured deployment agents are available and ready. Deployment agents can be upgraded later and they will work without upgrade to them as well.
34
Release paths are unchanged.
35
The above confirms upgrade looks successful. It is possible to do further verifications using RM Client and doing a trial release or two in a demo environment.
36
37
7. Release management service and web, config file changes, update.
There could be changes made to config files, such as ApprovalRequestEmailLanding, which enables to connect to online available release management web site via a mobile phone etc, to do release pipeline approvals. These changes need to be reapplied in release management web and service config files. The backups of config files made in step 2 (2. Backup config files of RM Service and RM Web.) come in handy for this effort. It is not advisable to replace the new configs entirely with backup config files. Only required changes should be updated carefully to new config files referring the backup config files.
For example without the changes applied the email approval request link will not work without network or vpn connection to domain network which release management server belongs to.
View request here linked to local network url.
38
This can be updated in ApprovalRequestEmailLanding configuration in config files of web and service of the release management.
39
40
Once this is updated the online release management web site link in View Request for approval request emails is set by RM server.
44
8. Release management client previous versions with release management server 2013.4. in another machine.
If release management server is updated to 2013.4, all release management clients connecting to it should be updated to 2013.4. Release management client 2013.2 cannot connect to release management server 2013.4.
45
Once upgrade to release management client by uninstalling 2013.2 and installing 2013.4 allows connection to release management server 2013.4.
After upgrading client to 2013.4 there could be an incorrect configuration shown mixing up https and http when connecting initially.
47
This can be fixed by selecting HTTP option and then selecting HTTPS option again.
48
The client in outside release management server machine succeeds connecting to release management server.
49

Sunday, 25 January 2015

Stylecop with TFS Build without Changing Build Template

How to setup TFS builds to validate stylecop code standards? One way to implement using alteration to TFS build templates. Below few posts give good explanation on how to do this with TFS build template modification
https://msdn.microsoft.com/en-us/magazine/dn451443.aspx
http://www.towfeek.se/2014/05/customize-your-tfs-build-process-to-run-stylecop/
http://tfsbuildextensions.codeplex.com/wikipage?title=How%20to%20integrate%20the%20extensions%20into%20a%20build%20template&referringTitle=Documentation
Is there a way to do this without build template alteration? Of course yes, thanks to StyleCop.MSBuild by Adam Ralph  this is possible now (Brief introduction on Stylecop.msbuild here).
Let’s have a look at step by step how to setup stylecop with TFS builds.
Right click on the Visual Studio solution Go to “Manage NuGet Packages for Solution”.

1
Search for stylecop. Stylecop.MSBuild will be in the results.
2
Click on Install and it will download StyleCop.MSBuild.
3
Select available projects in the solution and click OK. If new projects added to solution they can be selected by going to “Manage NuGet Packages for Solution”. Click on Manage installed package and select the new projects available.
4_1
SyleCop.MSBuild will be installed for selected projects.
5
This will add packages folder to the solution.
6
7

Right click on packages folder and undo pending changes. Undo changes will not remove the package folder from local folder and will be available to for the solution in this machine.
7_1
 7_2
7_2_1
This will prevent packages folder and contents being checked in to TFS. It is possible to set this package to automatically downloaded when the solution built.
 7_3
A file packages.config will be added to each project in the solution and make sure to check this in.
8
Project file (.csproj) will be modified to add required configurations for StyleCop.
9

Right click on the solution and enable nuget package restore for the solution. This will allow other team members to automatically download NuGet packages of the solution when it is built.

7_6

This will add few files to solution and change the .csproj files.

7_7

7_8


When the project is built the StyleCop violations are shown.
10
After fixing all violations in code still three violations shown based on temporary files generated when building .Net framework 4.5 projects.
11
12
Below link suggests few ways to fix this issue.
http://stackoverflow.com/questions/12405619/temporarygeneratedfile-guid-in-obj-debug-breaking-build
Out of them best solution is adding option to ignore the temporary files in the .csproj file. Since .csproj file will be checked in this fix will be available for other team members and build agents.
Unload project and edit to change the .csproj file.
13
14
Add

<ItemGroup>
<ExcludeFromStyleCop Include="$(IntermediateOutputPath)\**\*.cs" >
<Visible>False</Visible>
</ExcludeFromStyleCop>
</ItemGroup>

as shown below inside the StyleCop section added by the StyleCop.MSBuild installation.

15

Reload project.

16


Now all violations are fixed.

17

To verify StyleCop violations still validated after the above fix for temporary files, purposefully create a violation and verify.

18 


19



Fix the violation and check in the solution to TFS. A CI build using default build template runs successfully.

20


To verify TFS build gives warning when there is a StyleCop violation purposefully create a violation and check in.

21

Local build in VS show violation.

22



CI build shows SA1515 violation as a warning.

23

To make this violation to fails the build, add below to .csproj StyeCop added property group.

<StyleCopTreatErrorsAsWarnings>
    false
</StyleCopTreatErrorsAsWarnings>

24


This will make the violation to fail the build locally.

25

CI Build also fails with StyleCop violation.

26

SuppressMessage can be added to code (Method or Class level) and works fine with local builds and TFS builds.

29

 30

31

Using StyleCop.MSBuild it is possible to run StyleCop with TFS builds without altering build templates and without installing StyleCop in TFS Build Agents.

Popular Posts