Visual Studio Extensions: Editing code files in the current solution?

Is there a way to get a list of all of the .cs files in a solution, and edit them using the vs2010 interface?

im trying to develop an extension that will open up my code files, and tweak them automatically, and then resave them. Ive seen extensions do it before.

If this is not possible, is it possible to get a list of file locations perhaps? so i can edit them like normal files?

Answers


You might want to look into the EnvDT100 namespace. In that you have the Solution4 interface which allows you to open your solution object. Within the solution object you will find all of your projects and within these you will find the code files.

You can programmatically load your code files if you get the FileCodeModel from your ProjectItem which you can find in your projects.

EDIT:

You can get the name (including the path) of the files by using the Name property of the ProjectItem.


Need Your Help

Order between destruction of global object and atexit in C++

c++ order atexit global-object

I wonder that can sure order between destruction of global object and atexit in C++

How to add existing project to VS2013 from Github

visual-studio-2013 github version-control

i have one project in Github. i just like to know how could i attach that project with my local VS2013 so i can work and commit and other team member too. i search google lot to know how to attach