Working around "one executable per project" in Visual C# for many small test programs

Posted by Kevin Ivarsen on Stack Overflow See other posts from Stack Overflow or by Kevin Ivarsen
Published on 2010-05-17T02:20:37Z Indexed on 2010/05/17 2:30 UTC
Read the original article Hit count: 311

When working with Visual Studio in general (or Visual C# Express in my particular case), it looks like each project can be configured to produce only one output - e.g. a single executable or a library.

I'm working on a project that consists of a shared library and a few application, and I already have one project in my solution for each of those. However, during development I find it useful to write small example programs that can run one small subsystem in isolation (at a level that doesn't belong in the unit tests).

Is there a good way to handle this in Visual Studio? I'd like to avoid adding several dozen separate projects to my solution for each small test program I write, especially when these programs will typically be less than 100 lines of code. I'm hoping to find something that lets me continue to work in Visual Studio and use its build system (rather than moving to something like NAnt).

I could foresee the answer being something like:

  • A way of setting this up in Visual Studio that I haven't found yet
  • A GUI like NUnit's graphical runner that searches an assembly for classes with defined Main() functions that you can select and run
  • A command line tool that lets you specify an assembly and a class with a Main function to run

© Stack Overflow or respective owner

Related posts about c#

Related posts about visual-studio