Visual Studio Development Bookmark and Share   
 index > Visual Studio Guidance Automation Toolkit > FileCodeModel null on none project file...
 

FileCodeModel null on none project file...

Hi!

I'm creating a program that looks at source files and performs certain checks on them. This is all done at the source file level (i.e. there is no reference to a project or solution). I'm adding functionality so that when a user double clicks on a node in a GUI (where there is one for every method and property in a file) it loads up visual studio and highlights that method or property.

Before launching a new Visual Studio, I check all the open visual studios to see if they have a Solution which already contains this file and if so perform all the logic on that. This works great as the source file has already be parsed and has a lovely FileCodeModel for me to iterate through and fine the method (complete with start and end points!).

The problem comes when there a) isnt a visual studio instance open or b) the file being checked doesnt belong to an open project. In this situations the FileCodeModel is null. Now when I check the project for this its called "Miscellaneous Files" or something similar; so I assume when ever you open just a single file in Visual Studio it goes in here.

What I don't understand is why can't I access the member collection for this file? Obviously Visual Studio does have the information for it, because all the members / classes / enums etc are in the drop downs at the top of the file (in the IDE). Is there another way to access this information or force Visual Studio to create a FileCodeModel for this? The only (hack) solution I can think of is creating a new Visual Studio process, where I create a new solution and project in this to force it to make a model. This how ever will be expencive; I'm sure the information is already stored somewhere!

Thanks.

Goksly  Saturday, September 22, 2007 9:28 PM
Hi,

This is really more a VS extensibility question than a GAX one, please try to post it to the VS extensibility forum here in MSDN.

thanks,
-Victor.
vga  Sunday, September 23, 2007 8:03 PM
Hi,

This is really more a VS extensibility question than a GAX one, please try to post it to the VS extensibility forum here in MSDN.

thanks,
-Victor.
vga  Sunday, September 23, 2007 8:03 PM

You can use google to search for other answers

Custom Search

More Threads

• On Package Load Templates Exception?
• Help! Recipe Framework Error - Register Recipe "EnvDTE.Project, EnvDTE"
• How does the .vstemplate run?
• Visual Studio 2008 Smart Client software Factory
• Toolkit for GAX/GAT released!!
• Cannot install DataAccessGuidancePackageSetup.msi
• Reference Errors..
• SFT Wix Installer error
• Smart Client Application Creation Error.
• Has anyone got the "TypeBrowser" working?