Setting Up Your Environment

IOTA^_^    

ASP.NET Developer's JumpStart
By Paul D. Sheriff, Ken Getz
Table of Contents
Appendix A.  Programming Standards


Before you can begin coding, you'll need to set up your computer, and Visual Studio .NET, to make the best use of your time and the tools. The next few sections discuss the details of architecting a maintainable desktop computer environment and choosing the important Visual Studio .NET options.

Computer Setup

It's important that you configure your development system appropriately. If you're working with multiple developers, this is especially important, because you want all computers to be configured similarly.

We've found that it's crucial for developers to be able to rebuild machines, from scratch, with a minimum of effort. This means that it's imperative that data be stored separately from the operating system. This way, you can "blow away" the operating system at any time without losing data.

We suggest the following strategy, which has worked well for us:

  • Create a partition just for the operating system. This partition should be at least 4 to 6GB. This partition will be your C: drive. Make sure you use an efficient file system, such as NTFS. FAT and FAT32 are both inefficient and unsecurable.

  • Install an appropriate operating system (Windows 2000, Windows XP, or Windows .NET) onto your C: drive.

  • Once Windows is installed and running, rename your CD-ROM (or DVD, or other optical drive used for installations) to a "high" drive letter (we use X:) so that other installed drives won't move the drive letter for the optical drive later on.

  • Create two more partitions. The first, D:, will be used for your data, projects, and applications. You should use NTFS for this partition, as well. The other partition, E:, should be the same size as your C: drive and must be formatted using FAT or FAT32. You'll use this drive to create an image of your C: drive.

  • Install all your standard applications. Make sure any personal data files (such as an Outlook PST file) are stored on the D: drive. (We suggest you also set your My Documents folder to point to a folder on the D: drive.)

  • Once you have all your standard applications installed, you can create an image copy of your C: drive. Using a tool that creates exact images of drives (such as Norton Ghost(C) or PowerQuest's DriveImage(C)), create an image of your C: drive and store it on the E: drive.

Your machine is now ready to be used. If you ever need to restore your C: drive to a working configuration, you can simply restore the saved image, which takes minutes rather than the original hours you invested in creating and installing your C: drive.

Visual Studio .NET Options

Visual Studio .NET includes many options that define the behavior of the environment and the features in new projects. You'll want to make sure developers within your organization have set up their environments in the same way. We've outlined, in the following list, some important settings you'll want to consider. Each heading lists settings within the Options dialog box (use the Tools, Options menu item to display this dialog box):

  • Environment, Projects and Solutions. Set the Visual Studio Projects Location property to the location where you will be creating all your Visual Studio projects. This will ensure that the SLN file is located in the same location as your project files.

  • Text Editor, Basic, General. Unselect the Hide Advanced Members option. Some members will not show up in the IntelliSense lists if you do not do this. (We have no idea why Microsoft included this option. How can you program with some of the options missing from the IntelliSense? We just don't understand this one.)

  • Debugging, Edit and Continue. Select the Allow Me to Edit VB Files While Debugging option. This is a big change for VB6 developers in that environment, you could change code while in Break mode and have your code changes compiled and added to the project debugging session immediately. In Visual Studio .NET, you can't even make changes to the files while debugging unless you select this option. Even after selecting this option, you'll need to rebuild your project after making changes during a debugging session.

    You may also want to select the Always Ignore Changes and Continue Debugging option. Without this change, you'll either need to respond to an alert each time you make changes during debugging, or even worse, restart debugging immediately after making a change.

Option Strict

In VB .NET, Option Strict is off by default this is a poor decision, in our eyes, because it allows the same sort of code you might have written in VB6, including embarrassing type conversions. As it is, you must open the project properties for each new project you create in order to turn on Option Strict (or, you can manually add it to the top of each file, which is certainly an onerous task).

You can set Option Strict on in VB .NET for all new projects you create, but it's a nontrivial task. Although there may be a simpler way, we've found that you can modify the project templates themselves, adding the instruction to include this directive for each new project you create.

To do this, find the folder containing all the project templates. If you followed the preceding convention for setting up your machine, this folder is located under C:\Program Files\Microsoft Visual Studio.NET\Vb7\VBWizards. You'll find a number of subfolders within this folder, but you're looking for files named *.vbproj within this location. (You need to modify each of these, indicating that you want to turn on Option Strict for each project template.) Table A.1 contains a list of the folders and their corresponding project templates.

Table A.1. List of Folders Where Project Templates Are Located
Folder Name Project Template
ClassLibrary Class Library
ConsoleApplication Console Application
MobileWebApplication Mobile Web Application
WebApplication ASP.NET Web Application
WindowsApplication Windows Application
WindowsService Windows Service
WindowsControl Windows Control Library
WebService ASP.NET Web Service
WebControlLibrary Web Control Library

The simplest way to find each project file is to use Windows Explorer's Search tool. Once you've browsed to the correct folder (C:\Program Files\Microsoft Visual Studio .NET\Vb7\VBWizards), click the Search button in Windows Explorer, and enter *.vbproj as the search criterion. Once Windows Explorer has found the list of VB projects, load each file into a text editor and modify the XML at the top of the file so that it looks something like this:

 <VisualStudioProject>     <VisualBasic>         <Build>             <Settings               OptionExplicit = "On"               OptionStrict = "On" 

You'll find a lot more XML in the templates we've removed all the nonessential information here. Leave the rest of the XML elements alone. We've also added the OptionExplicit setting here, because you're likely to want that on, as well.

Save each file, and the next time you create a project based on one of these templates, Option Strict will be on, by default. You will definitely want to have Option Strict on for your development in VB .NET, and you'll forget to turn it on manually if you do not perform these steps to add it to each project template.


    IOTA^_^    
    Top


    ASP. NET Developer's JumpStart
    ASP.NET Developers JumpStart
    ISBN: 0672323575
    EAN: 2147483647
    Year: 2002
    Pages: 234

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net