Take the 2-minute tour ×

My team is currently locked into using a tool we dislike that takes the form of a Eclipse plugin and a .jar; the plugin gives us a button to quickly run a single file's code (via invoking the main .jar and passing to it the current file). We want to move to C#.net. Is there any way to get Visual Studio to replicate this behavior? Obviously we could put each runnable class into its own project in our solution, but that requires checking a lot of project files into source control. Ideally we'd have a main() method in each file and could tell visual studio to run just that file for development purposes, while the finished software would be run from a single entry point using command-line parameters.

(I don't want to give too much information here regarding the purpose of the software, so please just accept that the current setup makes a lot of sense for what we're doing and changing it too much would be rejected by management.)

share|improve this question
Why can't you use a unit testing framework? –  Oded Jul 19 '12 at 18:29
Are you sure you want to keep this kind of developer workflow? It looks to me that it deviates too much from how normal development works. And like Oded said, proper unit testing should get rid of most reasons to actually run the application itself. –  Euphoric Jul 19 '12 at 18:31
@Oded We'd like to be able to unit test other parts of the code, and we don't want all the software functions to run in their entirety during a build because many of them won't work on the build server. Can we segregate unit tests so that some of them are required for a build to be acceptable and some of them don't fire during the build sequence? –  Yamikuronue Jul 19 '12 at 18:32
Yes, you can. Depending on the framework you use, some support categorization so you can selectively run them on the build server. –  Oded Jul 19 '12 at 18:33
@Euphoric Yes. This isn't normal software; again, if I explained what we were making the workflow would make sense, but I don't feel comfortable getting into too much detail (I'm probably being silly about it, but better safe than sorry when corporations are involved) –  Yamikuronue Jul 19 '12 at 18:34

3 Answers 3

up vote 5 down vote accepted

What you are describing should be covered by a unit testing framework (to test your different classes in isolation).

nUnit supports categories, allowing you to selectively run sets of unit tests as needed.

share|improve this answer
Can I do this with the built-in unit testing tools? –  Yamikuronue Jul 19 '12 at 20:29
@Yamikuronue - Looks like it: msdn.microsoft.com/en-us/library/dd286683.aspx –  Oded Jul 19 '12 at 20:34

I believe that TestDriven.Net has this feature. Simply right click on a methid and then select the TestDriven.Net "test with debugger" option http://testdriven.net/quickstart.aspx

share|improve this answer

I believe it could be done like this, but I'm not sure if it can really be implemented.

It would implemented Visual Studio addon, this addon then adds a popup action to source files. When action is executed, the code is compiled into assembly. Then using reflection, the class in file is found and checked against contract. This contract can be either interface of specific method. This contract is then executed.

share|improve this answer

Your Answer


