简体   繁体   中英

VS2008 Macro: Perform action on every code file in the solution

I have recently noticed how interesting Visual Studio's macros are. I did not use VB for ages so it took me a while until i finally managed to write a little macro that performs some stuff on the currently open document.

Enthusiastically, I next wanted to use this macro on every source code file (.cs) in the solution without having to manually open all files. Could you give me a quick hint on how to do this?

Check out the DTE object reference. Inside a macro you can reference some really neat global properties, like DTE.Solution , which returns a Solution object that describes the currently open solution (and, not surprisingly, has a Projects property, which is a collection of all Projects in the solution). You should be able to iterate over pretty much anything you want at that point!

Have fun:)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM