Tuesday, December 06, 2005

Visual Studio Extensibility - nested file within a project

Trying to make my development life easier, I've made a Code Generator with CodeDOM.
But sooner after that, I've a problem in maintaining the generated codes, in the sense that, whenever, there's some new changes in the source schema, I've to recompile the thing all over again, and it takes... at least 2 digits of seconds.

Thus, my journey of VS Extensibility started...

The very first thing that wanted to find out about, which I didn't seems to see related post (googled) is this:

For my VB.NET project, usually there's .aspx and .aspx.vb which is nested together.
But I've a class which I generate for each form (a form binder), which I wanted to it to nest together under the .aspx file.
After some research and a few hours of searching the registry, I've got it!

Say, I wanted to put my generated code as ABC.aspx.bo, the bo extension stands for business object.

To achieve this, I can simply add a registry key here:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Projects\{E24C65DC-7377-472B-9ABA-BC803B73C61A}\RelatedFiles\.aspx

That's this key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Projects\E24C65DC-7377-472B-9ABA-BC803B73C61A\RelatedFiles\.aspx\.bo

I'm not sure the GUID for all installation of VS2005 is the same or not, but you can do a search for it in your registry.

The particular project (GUID E24C65DC-7377-472B-9ABA-BC803B73C61A) is simply a webproj, and that's how it came about it.

The next thing that I wanted to do is to make it such that the compiler will compile my .bo file as if it is a .vb file, so to say, make it a Partial Class of the main aspx page class.

If you have any idea or suggestion, do let me know.

Cheers!

No comments: