Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is the best way to write and run small scripts and tasks that are specific to a particular .Net project? Such things as configuring a database or confirming proper connections to servers.

In Ruby, I would build rake tasks for this sort of thing.

I am currently using unit tests for these tasks as they are easy to run within VS and they have access to all the necessary libraries and project code. However, this is not really their intended purpose and, with the dropping of Test Lists in VS 2012, it does not work nearly as well as it used to.

Is there a better solution than writing a console project to handle these little code snippets I need to run periodically?

share|improve this question
Powershell. You got all of .NET exposed there and it is built-in for any recent version of windows. – Daniel Iankov Sep 9 '12 at 5:48
Why didn't you add this as an answer? You don't know of any good tutorials on programming for Powershell, do you? – oillio Sep 9 '12 at 17:01
up vote 1 down vote accepted

Powershell is the canonical answer if you need access to your project libs, as you wrote. However, for a lot of simple tasks I still use "classic" Windows shell scripts, as long as the task can be easily solved with that. For example, simple file copy operations, folder creation etc. Another alternative is VBScript, if Windows shell script is not powerful enough. VBS misses direct access to .NET libs, but it has access to classic COM components, and was ok for me in the past for example for text file manipulation with regular expressions and similar things.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.