Documenting has never been so easy

Helixoft Blog

Peter Macej - lead developer of VSdocman - talks about Visual Studio tips and automation

You surely know what I'm talking about. We often need to run and test simple code chunks or only one statement while we are coding. It may be very annoying to run main project every time we want to test our new five lines long function. Fortunately, there are better ways to do it.

Here are all options that I have found:

  1. As already mentioned, place the code snippet to your main project. For example, you can insert it in some button event handler and then test it by pressing the button. This is cumbersome and time consuming.
  2. Don't place it in your main code. Just run the main code in debug mode and pause it, e.g. with breakpoint. Then open immediate window and test your expression. This has one big disadvantage, you cannot declare new variables or functions in immediate window.
    The two previously mentioned methods have one disadvantage. You cannot do it at design time, you need to run your project. (UPDATE: You can use Immediate window in design time in VS 2005 and higher. In VS .NET 2002/2003 you get "The expression cannot be evaluated while in design mode." error.) Or you need to have opened dummy project in separate VS instance. The following two solve this problem.
  3. Use Macro IDE. This is my favourite approach but it only works for VB .NET. As you already know, VS macros are nothing else than VB. NET functions So, just create macro with name "Test" and insert your code there. Then you can run it or debug it.
  4. Use Snippet Compiler. It compiles code snippets and works with VB .NET and C#. While it's not VS add-in but standalone application, you can still call it from VS. Just define it as external tool in Tools - External Tools. You can also place it on the toolbar or menu or even right-click context menu the same way you do it with built-in commands and macros.


Start generating your .NET documentation now!


Free, fully functional trial

Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Set of techniques which have for object the commercial strategy and in particular the market study.