When you get beyond simple forms based applications and you're ready to tackle something a little more powerful, you might discover that you need programming tools that are more powerful too. Framework has you covered!
One of the lesser known parts of the Microsoft Framework SDK is the Framework tools. These tools are a treasure chest of capability that a lot of programmers simply don't know about. One reason for that might be that you normally run these tools from the command line. For those of us who have been around for a few years, that means "DOS". It's almost like in the old days! (DOS will live forever!)
Since our focus at About Visual Basic is programming and code development, this series covers:
In addition, a Quick Tip - Versions of Your Programs - introduces the different version numbers - Major, Minor, Build, and Revision - that can be specified for a program. .NET gives you three different "versions" of version number!
Because most of these tools must be used at a Command Prompt, you should know a few tricks before starting on any of the articles.
How to start the Visual Studio Command Prompt.
If you try to use any of these tools without this trick, you will have a lot of trouble because the Command Prompt won't find the tool. For example, suppose you open an ordinary Command Prompt window and then enter the command:
This should start the Intermediate Language Disassembler. But it might just display the error message:
ILDASM is not recognized as an internal or external command, operable program, or batch file.
This is an example the kind of confusing message that made DOS so frustrating. The message doesn't have much to do with what's actually wrong. The problem is that DOS needs to know where a program is as well as what the name is. If the "current directory" isn't the one where the program is, you have to add some "where" information. You could fully qualify the command. If you're using Visual Studio 2010, the correct command is probably:
"C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\ILDASM"
(including the quotes since there are lots of spaces in the name)
But then, the other files you want to use are probably in other directories so you'll still have problems ... other than typing all that correctly. The easier thing to do is to set the path - the collection of directories that are searched automatically - to include the Framework SDK directory.
Up to Framework 2.0. Microsoft provided a batch file just to solve this problem named SDKVARS.BAT. That set the path correctly and, as long as the current DOS window remained open, you could execute any of the Framework tools from any directory. More recent Framework versions rely on a command in the Visual Studio Tools folder. For Visual Studio 2010, these are named:
Visual Studio Command Prompt (2010)
- or -
Visual Studio x64 Cross Tools Command Prompt (2010)
Click Here to display the illustration
These are simply shortcuts to a different batch file that, currently, is called vcvarsall.bat. This batch file does more than the old SDKVARS.BAT file did, including different code for Intel and AMD based PC's. Since Microsoft may update these in the future, you're encouraged to use them.
Installing Files for Framework Tools with VB.NET Express
If you're using the free Express version of Visual Basic, you won't have some of these tools installed, including the Visual Studio Command Prompt batch files. The easiest and quickest way to make sure you have the complete set is to install the free trial version of Visual Studio. It will time out (usually in 30 days) but you will be left with a functional set of tools. Be careful when reclaiming the hard disk space to avoid deleting something you might continue to need.
Tips For Using the Command Prompt Window
Back in the Good Ol' Days, when you had to do almost everything in DOS, everybody knew these tricks. Today, many programmers seldom use a Command Prompt window. It's a different environment!
The one essential command you will have to know is CD - Change Directory. Commands always assume the "current directory" unless you fully qualify them with a path. So, if you enter a command like:
NGEN INSTALL MySolution.exe
The system will expect to find MySolution.exe in the current directory or the current environment path. To solve this problem, it's handy to know how to change directories in a Command Prompt window quickly without typing the whole thing in.
Tip 1 - You can't copy and paste in the Command Prompt window with Ctrl-C and Ctrl-V. You have to right click and select Paste from the context menu.
Tip 2 - The fastest way to get the path you need to paste is to copy it from the address box in Windows Explorer.
So ... to change to the long path I'm using without typing 112 characters, I copy from Windows Explorer, enter CD in the Command Prompt Window, paste the path, and press enter. I enclosed the path in quotes in the example, but in this case they're not actually required.
Click Here to display the illustration