# Your First Program

## Opening Your First Program

1. Download Welcome.zip and save it on your computer.

2. Extract (Right-click on the file, then click on “Extract all”) this archive. Do not simply double-click on it, as that would only give you a preview of the archive without actually extracting it.

3. Go in the “Welcome” folder that was created.

4. Double click on the “Welcome.sln” file.

5. If you are prompted with a screen like this one:

   Pick “Visual Studio 2019” (and not Visual Studio Code or Blend for Visual Studio).

6. Visual Studio (VS) should start, you don’t have to register to the “Visual Studio Team Services Organizations” (but you can, using your @augusta.edu account, if you want), discard the security warning if there is any.

7. In the “Solution Explorer”, to the right, expand all the items that can be expanded by clicking on the ▷ symbol.

## Compiling and Executing Your First Program

1. In the Solution Explorer, double-click on `Program.cs`. This is the source code of the application you are actually considering.
2. Let’s compile this program, using `Build` → `Build solution`. What happened?
3. Let’s run this program, using `Debug` → `Start without Debugging`. What happened?

You will extensively compile and run programs in this class. Instead of having to click twice, I highly recommend that you start now memorizing shortcuts:

- Use `Ctrl` + `Shift` + `B` to build the solution,
- Use `Ctrl` + `F5` to start the program without debugging.

With `Alt` + `F4` (to exit any program), that makes 3 shortcuts already! You can find a complete list at http://visualstudioshortcuts.com/, I will try to introduce some of useful shortcuts as we progress.

# Configuring Your Installation

You do not need to install Visual Studio (VS), since it is already installed on the lab’s computer. If you want to install it on your own computer (which is recommended), go to “Installing Visual Studio On Your Own Computer” below. In both cases, we want to tune the installation a little bit:

1. Make Windows Explorer show the file extensions. Follow the instructions on microsoft’s page, on this website, or consult the textbook.

2. Launch VS, and make sure the line numbers are shown: “Tools” → “Options” → “Text Editor” → “All Languages” → “General” → “Line Numbers” (VS 15.5.2), or “Text Editor” → “Options” → “All languages” → “Line Numbers”.

3. Activate word-wrap in VS. Refer to this page for VS 2015, or this page for VS 2017 and 2019). The item to be clicked should look like this:

   If you were successful, you should go from

   to

   See the difference? On some versions, the horizontal scrolling will disappear, and every line that is too long is “wrapped”, and this is indicated with the sign.

# Backups

## Finding The Right Tool

Since you can not store files permanently on the lab’s computer, you will have to store them either

- On an external / removable data storage: USB flash drive, External hard disk drive, or any kind of USB mass storage device, or
- On a server: the University has a partnership with box.com, and you can follow this tutorial to get started, but any service (Google Drive, Dropbox, OneDrive, etc.) would do.

If you chose the “remote” option (i.e., using a server), do not install a synchronization software (like Google Drive and Sync, Box’s app, etc.) on the lab computer: it will likely not work, due to University rules. Instead, create the structure / project / files on the computer during the lab, and upload them (using the web-interface) at the end of the lab. Make sure to always upload your files before unloging from the computer.

## Making Sure You Have the Right Files

Now that you know where to store your files, create a folder for this class, and a subfolder for the first lab. You organization should look like the following:

    └───csci1301
        └── 01_lab
            ├── Welcome.zip
            └── Welcome
                ├── Welcome.sln
                └── Welcome
                    ├── Welcome.csproj
                    ├── Properties
                    │   └── AssemblyInfo.cs
                    ├── Program.cs
                    ├── obj
                    │   └── Debug
                    │       ├── Welcome.pdb
                    │       ├── Welcome.exe
                    │       ├── Welcome.csprojResolveAssemblyReference.cache
                    │       ├── Welcome.csproj.FileListAbsolute.txt
                    │       ├── TempPE
                    │       ├── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
                    │       ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
                    │       ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
                    │       └── DesignTimeResolveAssemblyReferencesInput.cache
                    ├── bin
                    │   └── Debug
                    │       ├── Welcome.vshost.exe.manifest
                    │       ├── Welcome.vshost.exe.config
                    │       ├── Welcome.vshost.exe
                    │       ├── Welcome.pdb
                    │       ├── Welcome.exe.config
                    │       └── Welcome.exe
                    └── App.config

You do not need to check that everything is here, just note that you have multiple folders, and that there are many files in the `Welcome` folder, not only the `.sln` and the `.cs`: make sure you copy all the structure when you want to backup or share your program! In this case, copying the `Welcome` folder is enough.

# Syllabus

Make sure you read the syllabus.

# Installing Visual Studio On Your Own Computer

This part gathers some references for you to install Visual Studio on your own computer, regardless of your operating system. Note that we are not installing “Visual Studio code”, but simply “Visual Studio” It is strongly encouraged that you do so, especially if you want to continue in a CS / IT degree, but not mandatory. The instructions are not really detailed: feel free to look on the Internet, ask your classmates or instructor for details or help.

There are plenty of ways this can go wrong, but make sure you read and followed those instructions carefully before asking for help.

## For Windows

1. Visit Azure Dev Tools for Teaching,

2. Log-in using your augusta credentials,

3. Look for Visual Studio. The path is Education > Software > Visual Studio Enterprise 2019 . You can search “Services” for the “Education” group and then click Software if the education group is not immediately displayed. It should look like the following:

   Normally, the following direct link should get you to the right page: https://portal.azure.com/?Microsoft_Azure_Education_correlationId=679c5fa4-bea5-4061-b6a5-93a017782c8c#blade/Microsoft_Azure_Education/EducationMenuBlade/software.

4. Download and install Visual Studio, leaving all the options on their default setting.

   If possible, check the box next to “Workload” → “Windows” → “.NET-Desktop Development”, or to “Workload” → “Other Toolsets” → “.NET Core cross-platform development”:

5. Enter the product key you obtain previously, following for instance the instructions in the documentation.

6. Configure the software as we did in “Configuring Your Installation”.

## For Mac and Other Linux Systems

You can either install another version of Visual Studio, or “emulate” Windows on your computer.

For the first option,

1. Download a version of Visual Studio at https://visualstudio.microsoft.com/vs/mac/. It differs a bit from the windows version, but that should not impact your experience in this class.
2. Configure the software as we did in “Configuring Your Installation”.

For the second option, you will need a Virtual Machine manager. This option works for Linux systems as well.

1. You can use
   1. “VMware Fusion v8/10 for Mac” (only for MacOS, available on OnTheHub),
   2. Virtual Box (for Linux and Mac),
   3. Virtual Machine Manager (for Linux).
2. Download a version of “Microsoft Operating Systems” from Azure Dev Tools for Teaching,
3. Install and run your version of Windows from your virtual machine, and follow the instructions for windows