I have a relatively small app that Im building using vb.net 2.0, and nant. Its a app that calls out to an external exe to produce some output files, then processes those output files afterwards.
I have built an interface to the exe, which I have created a stub implementation and the real implementation, what I would like to be able to do is use nant to either create a DEBUG build of the app, which calls the stub implementation, or create a PROD build of the app which will use the correct implementation.
How could I achieve this?
Also, I do not have the ability to update to a newer version of .net, just so you know 🙂
Thanks!
Mark
Best Answer
Have you thought of using the #if DEBUG preprocessor directive? You could do something like the following:
Just a thought, but if its a relatively small application, it is a nice, simple solution that doesn't require a lot of hassle. When you build your Debug profile, the DEBUG compiler option is automatically set. When you build your Release profile, the DEBUG compiler option is absent. In anything other than a simple app, I would say use an IoC framework...like Ninject. Its nice and simple, lightweight...should work well for smaller applications.