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.

No comments:

Be A Developer That Uses AI

Developers will not be replaced by AI, they'll be replaced by developers that use AI. Generative AI tools are revolutionizing the way de...