View
10
Download
0
Category
Preview:
Citation preview
Creating Projects using Microsoft Visual Studio 2013
CTEC1239/2015W Computer Programming
Star%ng Visual Studio 2013
• From the Windows 7 Start Menu …
Visual Studio 2013
• Click on New Project ...
Or File | New Project… Or [Ctrl]+[ShiH]+[N]
• The “New Project” dialog box appears
Choose the Language, Environment, and Project Type
• The C# project types used in CTEC1239 are: Console Applica3on (text) and WPF Applica3on (GUI).
• Choose Console Applica%on for most programs
Choose the Project Loca%on
• Click on Browse to pop up the “Project Loca%on” dialog box. From here, choose or create a folder in which to store your projects.
• Each project will have its own subfolder.
• Choose your USB or Network drive!
• Because of the DeepFreeze soHware installed on the lab computers, you may lose your files on drive C.
1
1
Give the Project a Name
• The name will be used for both the project subfolder and the executable.
• For example, for a C# Console app, the project folder will be C:\tmp\Test and the executable will be wriben to C:\tmp\Test\bin\Debug\Test.exe
• Remove the checkmark from the “Create directory for solu%on” box
• Click OK when done.
12
3
4
2
3
4
CREATING A C# CONSOLE APPLICATION
Summary: Crea%ng C# Console App Projects
1. Choose the language (Visual C#), environment (Windows Desktop), project type (Console Applica3on).
2. Follow the usual procedure... project loca%on and project name.
C# Console App Project
C# Console App Code
C# Console App Code (2)
• The C# using keyword includes .Net libraries.
• The C# namespace keyword is used because .Net classes are organized in assemblies.
• Your project is an assembly.
C# Console App Code (3)
• Like Java, each C# program must have consist of at least one class.
• The program entry point is “main”, but C# capitalizes the name to Main (so does VB).
• The fully-‐qualified name of the class in this example is Test.Program
C# Console App Files
• Don’t mess with the Proper3es folder! • The bin and obj folders are used for building (they can be safely deleted).
• Don’t forget the secret hidden .suo file.
Contrived C# Console Program Example -‐ Code
Cleaning C# Projects
• Close the project in Visual Studio. • Copy the .exe file from bin\Debug if necessary.
• Remove the bin and obj folders. • Delete the secret hidden .suo file.
Hello, Cruel World
• Create a new project called “HelloWorld” • Enter one line of code:
Hello, Cruel World
• When you build and run the project by clicking on the green arrow the resul%ng console window simply opens and closes
• The program completes too quickly for the user to see the output!
• One more line of code is needed:
Hello, Cruel World Complete
Archiving the Project
• Close Solu%on (from the File menu) or exit Visual Studio
• Using Windows Explorer, go to the folder where your project folder is
• Right click on the project folder and select 7-‐Zip and then
Archiving the Project
• Close Solu%on (from the File menu) or exit Visual Studio
• Using Windows Explorer, go to the folder where your project folder is
• Right click on the project folder and select 7-‐Zip and then “Add to ____.7z” (where ____ is the name of your project/project folder)
• A .7z archive file will be created, which you can either copy to your USB or Network disk, safely email, or post on BB.
Recommended