January 10, 2019
Re-download or transfer the files you saved last time (the whole Welcome
folder) on the computer and make sure you can still open the project with Visual Studio (VS). Do you remember how to build the solution and start the program without debugging? Using the shortcuts? If not, go have another look at the previous lab.
If your backup went wrong (you can’t open the project, it won’t compile, …), try to understand what happened. Then, re-download the “Welcome” archive, extract it and make sure you can build the solution and start the program without debugging.
Have a look at the following screenshot:
You should have roughly the same on your computer. If not, you can zoom to have a better reading.
Answer the following:
Close Visual Studio (VS). With the file explorer, create a new folder (call it for instance 02_lab
) and copy the Welcome
folder in it. In this exercise, you will rename and edit this copy.
Open with VS the copy of the Welcome
folder that you just created. Rename the solution within VS:
.sln
file changed?You should not rename a solution with the file explorer: always use VS to rename.
We will now change (edit) our “MyFirstProgram” solution.
program.cs
, replace "Welcome to the lab portion of CSCI 1301!"
with "This is my first program."
.Insert a new line after line 6, and paste the following:
Insert another new line after the one you just created, and paste the following:
WriteLine
and Write
?Insert another new line after the one you just created, and paste the following:
\t
is doing?Insert another new line after the one you just created, and paste the following:
\n
is doing?\
and the "
characters.Add a comment (using //
or /*
and */
) in your program.
Make a back up of what you just did: upload the 02_lab
folder you created previously on your remote backup, or copy it on your thumb drive. Do not use the “Save as…” capacities of VS: close VS and copy / upload the folder “by hand”, using the file explorer or a browser. Re-downloading or re-transfering it and re-opening it is a good way of making sure that your back up was correct.
If you followed the instructions carefully, your were able to build the solution and start the program without debugging after each step. As you know, C# has precise rules, and not respecting them can prevent your solution from being built by VS.
In this exercise, you are asked to do the following:
Build the solution, and note that an error is reported. In the build output (cf. the screenshot presented earlier, you may need to click on a tab in VS to see it), you will see a message like
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Make sure you can build the solution without error message anew.
Do it three times, in order to identify three different error messages, and three ways of breaking the rules.
If you have time or lack inspiration, you can try with the following, and see which one(s) make the building impossible (don’t forget to undo your change after):
using Sytem
class Welcome
with class TestOne
}
symbol) at the last line.Console.WriteLine
with CONSOLE.WriteLine
Console.WriteLine
with Console.WRITELINE
Console.
and WriteLine
WriteLine
and (
Write
and Line
Main()
with Method()