Code alteration before compile

Dec 3 2009 10:12 AM
Here is an interesting idea and it must be possible.

I have a project with 1 windows form, nothing on it.

I have a DLL with various code bits in it including a custom form.

The declaration of the form in app 1 would be: Public Class TestForm : Form nothing weird about that. The declaration for the form in the dll would be Public Class CustomForm : Form again nothing weird about that.

I include this dll into my project to be able to have the 'TestForm' inherit from 'CustomForm' however i only want to do this when the app is compiled. So during design time, 'TestForm' inherits from 'Form', then when the project is built i would like to replace the inheritance before it goes to the compiler but without altering the source code.

This must be already be done somewhere but i am unable to find any examples of this probably due to the fact that i do not know the correct terminoligy for this.

Can anyone help?
Cheers


Answers (5)