Can somebody help me on enumerating a C# project files and update the cs file headers in Visual Studio 2010? Any helpful code snippet or a pointer to that would be highly appreciated.
-
Can you be a little more verbose? Are you looking for a macro that runs inside of Visual Studio when you already have a solution open? Or are you talking about something you would run from the command line? Also, can you give examples of what kind of manipulation you want to perform on the CSPROJ and CS files? – Russell McClure Oct 15 '10 at 20:22
-
I want to develop a VS2010 extension, which will change the header of some cs files from the opened solution. – Anindya Chatterjee Oct 17 '10 at 05:40
-
1"update the cs file headers": C# files don't really have a header. Do you mean something like inserting a license comment at the top of a file? – Dirk Vollmar Nov 18 '10 at 13:25
3 Answers
Try the solution file parser or you could use Visual Studio Extensibility Objects (DTE) by importing the envdte.dll. There is a lot of documentation for this.
Check out the Visual Studio SDK at http://msdn.microsoft.com/en-us/library/bb166441.aspx and checking out the samples.
Visual Studio Extensibility Samples at http://msdn.microsoft.com/en-us/library/bb458154.aspx
VSX Home on Code Gallery at http://code.msdn.microsoft.com/vsx
"Official home for Visual Studio Extensibility (VSX) online resources on Code Gallery. Here, you will find samples, deep dive documentation, links to shared source projects and other resources to help you extend Visual Studio. This page is maintained by the VSX team at Microsoft."
Solution Hierarchy Traversal at http://code.msdn.microsoft.com/SlnHierarchTraversal

- 21,470
- 7
- 78
- 106
- Search for all .csproj files in a folder and it's subfolders using your favorite file manager, (eg. FAR Manager, Total Commander etc.).
- To perform search and replace in .cs files you can use S&R plugin for FAR Manager (freeware) or "Advanced Find And Replace" application (shareware, but more powerful).

- 45,135
- 8
- 71
- 121
-
I want to do it within VS, not from outside of VS. I just want to create a extension which will do that. – Anindya Chatterjee Oct 17 '10 at 05:41