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.
Do one of the following:
or
02_lab
in it.Welcome1.zip
and extract it.Welcome1
folder located in it to 02_lab
. We will work with this copy instead of with the original files from this point.Welcome1
folder in 02_lab
and examine its structure and content. We can draw its structure as a tree:└───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
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:
Before starting the next part, have a look at https://docs.microsoft.com/en-us/visualstudio/ide/compiling-and-building-in-visual-studio.
02_lab/Welcome1
and open Welcome1.sln
with Visual Studio. Discard the security warning.Welcome1.cs
. This is the source code of the application you are actually considering.Build
→ Build solution
. What happened?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:
With Alt + F4, that makes 3 shortcuts already!
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:
Welcome1.cs
according to the instructions.========== 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:
using Sytem
Welcome1
with WelProj
//
before Main method begins execution of C# app
"Welcome to C# Programming!"
with "This is my program!"
}
symbol) before // end Main
Console.WriteLine
with CONSOLE.WriteLine
Console.WriteLine
with Console.WRITELINE
Console.
and WriteLine
WriteLine
and (
Write
and Line
Main()
with Method()
Welcome1.cs
and select “Rename”. Rename the file to WelProj.cs
.Solution 'Welcome1' (1 project)
, select “Rename”, rename it to WelSol
.Welcome1
folder, that you name WelSol
. Open WelSol/WelSol.sln
in VS: is everything all right? Exit VS.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.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?
The following are two independent tasks, to widen your understanding of this class, and to prepare you for the next labs, respectively.