In a project I'm working on we had this problem. Building the project of the web site was slow, and I mean real slow.
After doing some google-ing we came across a post of ScottGu's.
The solution we did, was deleting the refresh files of our library dll's and the performance issue is gone.
To perform code analysis it is pretty sure that you want to disable some rules. But how to share those over multiple projects in a solution.
Or you want to make it a standard over solutions. Well this post helps. And I copy/past the post. :-)
If your team has a minbar of Managed Code Analysis rules that must be
explicitly fixed or suppressed, it is possible to share the Managed
Code Analysis rule settings over multiple MSBuild projects (.csproj,
To share the minbar between multiple projects, do the following:
- Using Visual Studio, create a new empty project
- In Solution Explorer, right-click the project and choose Properties
- In the Project Properties window, choose the Code Analysis tab
- In the Code Analysis tab, choose the rules you want for your minbar
- In Solution Explorer, right-click the project and choose Unload Project, answering Yes to any prompt to save changes
- In Solution Explorer, right-click the project and choose Edit
- Search for the <CodeAnalysisRules> element and copy the text within it
- Create an empty text file called [team].CodeAnalysis.Rules.targets, replacing [team] with the name of your team
- In the text file enter the following, replacing [rulesettings] with the text copied above in Step 6:
If you do not want developers to be able to turn on extra rules over and above the minbar, do not add the '$(CodeAnalysisRules);' text.
- Using Visual Studio, open your projects
- In Solution Explorer, right-click a project and choose Unload Project
- In Solution Explorer, right-click the unloaded project and choose Edit
- Add the following <Import> element to the project, replacing [path] with
the path of the targets file created above. This needs to be the last
line (just above the closing </Project> element) to ensure that
settings within the project do not override the team settings:
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="[path]" />
- Repeat from Step 11 for each project you want to share the rule settings with
Any projects that imported the common rule settings via Step 9,
should now reflect these settings in the Code Analysis properties pane.
You can also share any MSBuild properties using similar steps.
Please Note: In order to avoid Visual Studio prompting about unsafe imported MSBuild projects, you need to explicitly trust the [team].CodeAnalysis.Rules.targets file. To do this, use the following:
- Run regedit
- Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\MSBuild\SafeImports
- Add a new string value called [team].CodeAnalysis.Rules.targets and set its value to the full path of the targets file.