Getting all projects inside loaded solution with EnvDTE
-
miércoles, 28 de diciembre de 2011 15:55
Hi all,
I want run code anlysis to all the projects in the current solution without checking run-on-build option in the project properties because running CA is slow and makes the build longer than usual.
The only option I have in Visual Studio 2010 is to select every project in the solution:
right click -> run code analysis.
I want to create an addin\extension that does the following:
- for each project enabled code analysis on build
- compile solution
- for each project disable code analysis on build
I'm looking for a piece of code that will gives me all projects inside a loaded solution using EnvDTE.
My solution is complex, it contains solutions-folders within solution-folders, C++\C# \Modling projects.
Also, when I get the item (UIHierarchyItem object) is there a way to get the project object so I perfom the following: Project.ConfigurationManager.ActiveConfiguration.Properties.Item("RunCodeAnalysis").Value = "True"
also, does anyone know a tool that maybe can help me instead of writing my own..?
Thanks,
Roy
R.R
Todas las respuestas
-
viernes, 06 de enero de 2012 17:15
While creating an extension or macro to do this would certainly be possible, have you considered simply creating an additional build configuration instead? I have used this approach for several years now, and it works quite well. For example, my "Debug" build builds in debug mode and runs code analysis. However, I also have a "Debug (No FxCop)" build that compiles in debug mode without running code analysis.
-
viernes, 13 de enero de 2012 6:08
Hi Roy,
Maybe this sample code will help you:
http://forums.asp.net/t/1002934.aspx/1
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Regards, Jun Zh - MSFT Microsoft Online Community Support

