Tuesday, December 29, 2009

Apply FxCop Rules to Multiple Solutions

It's easy to apply FxCop into the projects with Visual Studio. You don't need to manually change each project settings using the project Properties dialogue. You can just copy and paste the settings to each .csproj file which is the MSBuild file.

The steps to applied the same FxCop rules to the multiple projects at the same time are:

  • Unload the projects in a batch.
  • Edit the csproj files in a batch. This will automatically check the .csproject files out. Past the following lines into the .csproj file in each configuration files.

<PropertyGroup Condition=" '$(Configuration)$(Platform)' == 'DebugAnyCPU' ">

<RunCodeAnalysis>true</RunCodeAnalysis>

<CodeAnalysisRules>-Microsoft.Design#CA1005;-Microsoft.Design#CA1011;-Microsoft.Design#CA1009;-Microsoft.Design#CA1019;-Microsoft.Design#CA1000;-Microsoft.Design#CA1006;-Microsoft.Design#CA1046;-Microsoft.Design#CA1035;-Microsoft.Design#CA1033;-Microsoft.Design#CA1014;-Microsoft.Design#CA1017;-Microsoft.Design#CA1018;-Microsoft.Design#CA1060;-Microsoft.Design#CA1034;-Microsoft.Design#CA1052;-Microsoft.Design#CA1057;-Microsoft.Design#CA1030;-Microsoft.Design#CA1003;-Microsoft.Design#CA1007;-Microsoft.Globalization#CA1301;-Microsoft.Globalization#CA1306;-Microsoft.Globalization#CA1305;-Microsoft.Globalization#CA1300;-Microsoft.Globalization#CA1309;-Microsoft.Interoperability#CA1403;-Microsoft.Interoperability#CA1406;-Microsoft.Interoperability#CA1413;-Microsoft.Interoperability#CA1402;-Microsoft.Interoperability#CA1407;-Microsoft.Interoperability#CA1404;-Microsoft.Interoperability#CA1410;-Microsoft.Interoperability#CA1411;-Microsoft.Interoperability#CA1405;-Microsoft.Interoperability#CA1409;-Microsoft.Interoperability#CA1415;-Microsoft.Interoperability#CA1408;-Microsoft.Interoperability#CA1414;-Microsoft.Interoperability#CA1412;-Microsoft.Interoperability#CA1400;-Microsoft.Interoperability#CA1401;-Microsoft.Mobility#CA1600;-Microsoft.Mobility#CA1601;-Microsoft.Performance#CA1812;-Microsoft.Performance#CA1824;-Microsoft.Portability#CA1901;-Microsoft.Portability#CA1900;-Microsoft.Security#CA2116;-Microsoft.Security#CA2117;-Microsoft.Security#CA2115;-Microsoft.Security#CA2102;-Microsoft.Security#CA2122;-Microsoft.Security#CA2114;-Microsoft.Security#CA2123;-Microsoft.Security#CA2108;-Microsoft.Security#CA2107;-Microsoft.Security#CA2103;-Microsoft.Security#CA2118;-Microsoft.Security#CA2109;-Microsoft.Security#CA2119;-Microsoft.Security#CA2106;-Microsoft.Security#CA2112;-Microsoft.Security#CA2120;-Microsoft.Security#CA2126;-Microsoft.Security#CA2124;-Microsoft.Security#CA2127;-Microsoft.Security#CA2128;-Microsoft.Security#CA2129;-Microsoft.Usage#CA2227;-Microsoft.Usage#CA2212;-Microsoft.Usage#CA2219;-Microsoft.Usage#CA2228;-Microsoft.Usage#CA2240;-Microsoft.Usage#CA2229;-Microsoft.Usage#CA2238;-Microsoft.Usage#CA2239;-Microsoft.Usage#CA2242;-Microsoft.Usage#CA2230</CodeAnalysisRules>

<PropertyGroup>

Load the projects again in a batch.

Undo the .sln file if the solution file has been checked out by visual studio.

Tuesday, December 22, 2009

To-do list in TFS Project Migration

I can think of at least two reasons why project migration is not avoidable in TFS 2008.

  1. You want to rename your project. For complicated reasons, renaming is not supported in TFS. So the only you can achieve this is to create a new project then migrate everything.
  2. You want to change the process template you used in TFS project. Changing the template is not supported in TFS 2008 either.

Migrating the team project, you can easily think of three parts.

  1. Source control code
  2. Work Items
  3. SharePoint Documents

However there are other things you need to consider too.

  1. TFS groups and membership
  2. TFS security settings
  3. TFS queries

Some of these items are manual processes.

  • Like work items migration, you need to use TFS query to get the work items you need, then export to excel then import to the new TFS project.
  • SharePoint Documents.
  • TFS queries
  • TFS security settings.

Some of these items you can accomplish using scripts.

  • Group membership migration. I found one good tool you can utilize to migrate group membership in CodePlex
  • Source code migration. You can simply use TF.EXE to compose a batch file.

Before the migration you should consider to stop TFS SQL server's transaction log jobs. Then migrate. Restart the SQL transaction log job. Re-index the database to achieve the ultimate performance.

Thumbs Up to GitHub Copilot and JetBrains Resharper

Having used AI tool GitHub Copilot since 08/16/2023, I’ve realized that learning GitHub Copilot is like learning a new framework or library ...