CSCI 1301 - Lab 02

Clément Aubert

January 29, 2018

Deadlines: No deadline for this lab, but it would be preferable to finish it all before lab #3.

Dependencies: No part of the lab can be achieved without achieving the previous parts first.

Part I - Structure of a Project

Do one of the following:

    • Navigate to the the folder for this class you created during lab 01.
    • Create a folder for this second lab, let’s name it 02_lab.
    • In the examples from the textbook you downloaded and extracted during lab 01, find the folder ch03\fig03_01.

or

    • Create a folder for this class, and a folder named 02_lab in it.
    • Download Welcome1.zip and extract it.
└───Welcome1
    │   Welcome1.sln
    │
    └───Welcome1
        │   App.config
        │   Welcome1.cs
        │   Welcome1.csproj
        │
        ├───bin
        │   ├───Debug
        │   │       Welcome1.exe
        │   │       Welcome1.exe.config
        │   │       Welcome1.pdb
        │   │       Welcome1.vshost.exe
        │   │       Welcome1.vshost.exe.config
        │   │       Welcome1.vshost.exe.manifest
        │   │
        │   └───Release
        └───Properties
                AssemblyInfo.cs
  1. How many different extensions are they?
  2. Using a website like https://fileinfo.com/, give a brief description of those extensions.

Part II - Finding Answer

All the documentation for Visual Studio is at https://docs.microsoft.com/en-us/visualstudio/. The documentation for C# is at https://docs.microsoft.com/en-us/dotnet/csharp/. To get started, have a look at https://docs.microsoft.com/en-us/visualstudio/ide/creating-solutions-and-projects, and answer the following:

  1. What is a solution?
  2. What is a project?
  3. Which one contain the other: the solution, or the project?
  4. How are the templates organized?

Before starting the next part, have a look at https://docs.microsoft.com/en-us/visualstudio/ide/compiling-and-building-in-visual-studio.

Part III - Compiling and Executing Your First Program

  1. Go to 02_lab/Welcome1 and open Welcome1.sln with Visual Studio. Discard the security warning.
  2. In the Solution Explorer, to the right, expand all the items that can be expanded by clicking on the ▷ symbol.
  3. Answer the following:
  1. In the Solution Explorer, double-click on Welcome1.cs. This is the source code of the application you are actually considering.
  2. Let’s compile this program, using BuildBuild solution. What happened?
  3. Let’s run this program, using DebugStart 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:

With Alt + F4, that makes 3 shortcuts already!

Part IV - Breaking and Fixing

We will now try to break (i.e., make the compilation impossible) the program in various ways, and revert the changes that actually broke the program.

For each of the modification indicated below, do the following:

  1. Modify Welcome1.cs according to the instructions.
  2. Compile the program.

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Observe the error message, and infer what broke your program. Revert the change.

========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

Run the program, and infer why was this change innocuous to your program.

Here are the modifications:

Part V - Renaming Projects, Solutions, and Files

  1. Lets rename the solution and project within VS:
  1. Now, exit Visual Studio, and make a copy of your Welcome1 folder, that you name WelSol. Open WelSol/WelSol.sln in VS: is everything all right? Exit VS.
  2. Inside the WelSol folder, rename the Welcome1 folder to WelProj. Open the project in VS. Is everything ok? Not really. Exit VS, and rename WelProj to Welcome1. Make sure you can open and build that project correctly anew before continuing.
  3. In the Welcome1 folder, rename Welcome1.csproj to Welproj.csproj. Open the project in VS: is everything all right? Not really. Exit VS, and revert this change.

What can you conclude on renaming projects, solutions, folders and files, inside and outside of VS?

Part (Optional) - Pushing Further

The following are two independent tasks, to widen your understanding of this class, and to prepare you for the next labs, respectively.

  1. To get a better insight on the variety of programming languages, have a look at http://cs.lmu.edu/~ray/notes/pltypes/
  2. To get ready for the coming lab, do the following. Taking inspiration from https://docs.microsoft.com/en-us/visualstudio/debugger/debugger-feature-tour, set a breakpoint in your program and start the debugger. Examine the execution flow of your program, and advance the debugger, using F10.