.Net dependency to build debug using nant
I have a relatively small application that I'm building using vb.net 2.0 and nant. It is an application that calls an external exe to generate some output files, then processes those output files.
I have built an interface for the exe that I created to implement the stub and the actual implementation, what I would like to do is use nant to create a DEBUG assembly of the application that calls the implementation stub, or create a PROD assembly of the application that will use the correct implementation.
How could I achieve this?
Also, I have no way of updating to a newer .net version, so you know :)
Thanks! Mark
a source to share
Have you considered using the #if DEBUG preprocessor directive? You can do something like the following:
object myDependency;
#if DEBUG
myDependency = new Stub();
#else
myDependency = new Actual();
#endif
Just a thought, but if this is a relatively small application, this is a nice, simple solution that doesn't require much hassle. When you create your Debug profile, the DEBUG compiler option is automatically set. When you create your Release profile, there is no DEBUG compiler option. For anything other than a simple application, I would say I am using an IoC framework ... like Ninject. Its nice and simple, lightweight ... should work well for small applications.
a source to share
There are tons of DI frameworks out there and more. However, none of them (that I know of) are "build tools". If you need it fast, something like Funq (1) will do nicely or ProS (2) when done
you can read Daniel Katzulino's plugin on Funq (3) where he compares several DIs
I would have linked above but not resolved yet
a source to share