Unrestricted Getting Started with NX SNAP Chapter 3: Using Visual Studio Express Page 14
Chapter 3: Using Visual Studio Express
In the previous chapter, we developed code using the NX Journal Editor. This is a convenient starting point, since it
requires no setup, but it is really a fairly primitive environment. Except for very short programs, it is far better to
use a more powerful “integrated development environment” (IDE). The Microsoft Visual Studio “Express” editions
are free-ware single-language lightweight versions of the Microsoft Visual Studio IDE used by many professional
programmers. The idea, according to Microsoft, is to provide streamlined, easy-to-use IDEs for less serious users,
such as hobbyists, students, and people like you. Express Editions are available for the Visual Basic, C#, and C++
programming languages. In this chapter, we will be focusing on the Visual Basic 2015 Express package.
■
Installing Visual Studio
If you already have some version of Visual Studio 2015 installed on your computer, and you are familiar with it, you
can skip this section and proceed directly to the first example. If not, then the first step is to install the Visual Studio
2015 Express Edition for Windows Desktop, which you can download from here, or numerous other places.
If you can’t find the web page (because the Microsoft folks have moved it again), just search the internet for “Visual
Studio 2015 Community”. Make sure you get the “for Windows Desktop” version. A common mistake is to
download the “for Windows” version, instead, but this is for building Windows store apps, so it’s not what we want.
Follow the instructions to download the package and complete the installation. You will be given the choice of
doing a direct online install (by choosing the .EXE file), or downloading an image that you can burn onto a DVD and
use later (the ISO file). After you’re done, you should see Microsoft Visual Studio 2015 Express on your Programs
menu, and you should see a folder called Visual Studio 2015 in your My Documents folder. If you run into trouble, it
might help to watch this video.
Older versions of Visual Studio will not work because they don’t allow you to use version 4.6 of the .NET
Framework.
Unfortunately, the Visual Studio Express download is much larger than it was when SNAP was first conceived — it
has grown from around 80 MB to over a gigabyte. If you don’t have the patience or disk space to handle a package
this large, you can try the SharpDevelop IDE, instead. It’s only around 15 MB, and provides everything you need.
The instructions you read in this document won’t match SharpDevelop exactly, but it should be fairly easy to adapt.
You’ll need Version 4.x or earlier, as Version 5 no longer supports the Visual Basic language.
In the examples in this chapter, we’ll provide step-by-step instructions for writing the code, just as we did in
chapter 2, so it should be easy to follow. But if you’d like to get some additional information about the Visual Basic
language or Visual Studio, then one good place to start is this series of videos. There is a huge amount of other
tutorial material available on the internet, and you might find other sources preferable, especially if your native
language is not English.
■
Installing SNAP Templates
After installing Visual Studio, you should install three custom templates that we will be using as convenient starting
points when developing SNAP programs. You will find three zip files in […NX]\UGOPEN\SNAP\Templates. Again,
remember that […NX] is just shorthand for the location where NX is installed, which is typically somewhere like