HO CHI MINH CITY UNIVERSITY OF INDUSTRY
Author: Duy Thanh Tran – Phone : 0987773061- Email: – Blog:
HO CHI MINH CITY UNIVERSITY OF INDUSTRY
Author: Duy Thanh Tran – Phone : 0987773061- Email: – Blog:
Introduction to the Visual Studio 2010
Chapter 1:
HO CHI MINH CITY UNIVERSITY OF INDUSTRY
Author: Duy Thanh Tran – Phone : 0987773061- Email: – Blog:
What you
Learn in this
chapter?
What’s the
.NET Framework &
What it contains
What C# is
&How a
C# Program runs
Visual Studio 2010
& C#
DEMO C# Console
HO CHI MINH CITY UNIVERSITY OF INDUSTRY
Author: Duy Thanh Tran – Phone : 0987773061- Email: – Blog:
.Net Framework
[4.0]
Microsoft’s Modern
software development
platform
Support several programming languages:
C# ,VB, C++,F#
Common Language Runtime (CLR)
Include .NET Framework Class Library(FCL)
HO CHI MINH CITY UNIVERSITY OF INDUSTRY
Author: Duy Thanh Tran – Phone : 0987773061- Email: – Blog:
Programming language use to
create application will run in
the .NET CLR
Why
C# ?
Evolution of the C & C++ languages
Incorporate the best features from other
languages & Clearing up their problems
Syntax is simple
Directly accessing & manipulating
system memory
HO CHI MINH CITY UNIVERSITY OF INDUSTRY
Author: Duy Thanh Tran – Phone : 0987773061- Email: – Blog:
Windows Application
HO CHI MINH CITY UNIVERSITY OF INDUSTRY
Author: Duy Thanh Tran – Phone : 0987773061- Email: – Blog:
HO CHI MINH CITY UNIVERSITY OF INDUSTRY
Author: Duy Thanh Tran – Phone : 0987773061- Email: – Blog:
C# Source
(.cs)
C# compiler
Assembly
(.exe or .dll)
CLR loader
CLR
JIT compiler
Operating system
CPU & other
hardware
.NET
libraries
HO CHI MINH CITY UNIVERSITY OF INDUSTRY
Author: Duy Thanh Tran – Phone : 0987773061- Email: – Blog:
1
Write source code c# and saved file with
.cs extension
2
C# compiler=> Compile source code to an
intermediate language (MSIL)
3
MSIL is contained in an assembly(.exe or
.dll extension)
4
Can use source code or reference .NET
framework libraries
HO CHI MINH CITY UNIVERSITY OF INDUSTRY
Author: Duy Thanh Tran – Phone : 0987773061- Email: – Blog:
5
CLR runs on top of host operating system
6
CLR loads assembly & uses JIT compiler to
translate MSIL to native machine code
7
Load .NET libraries if need
8
MSIL code can execute on any CPUs if CPU
is supported by CLR
HO CHI MINH CITY UNIVERSITY OF INDUSTRY
Author: Duy Thanh Tran – Phone : 0987773061- Email: – Blog:
Powerful, professional Integrated Development
Environment (IDE)
Integrated compiler, debugger,
Other useful tool…
We can work:
Console application
Window application
Web application
.NET Libraries
HO CHI MINH CITY UNIVERSITY OF INDUSTRY
Author: Duy Thanh Tran – Phone : 0987773061- Email: – Blog:
Solution ???
Build
???
Debugging
???
HO CHI MINH CITY UNIVERSITY OF INDUSTRY
Author: Duy Thanh Tran – Phone : 0987773061- Email: – Blog:
Solutions and Projects group the items needed
to create a program or application:
A Solution can contain one or more Project
A Project represents a particular part of a
solution
A Project contains source code file, settings &
resource for application
A Project can contain Class Reference libraries
Etc…
HO CHI MINH CITY UNIVERSITY OF INDUSTRY
Author: Duy Thanh Tran – Phone : 0987773061- Email: – Blog:
HO CHI MINH CITY UNIVERSITY OF INDUSTRY
Author: Duy Thanh Tran – Phone : 0987773061- Email: – Blog:
1
Solution
1. File/New/Project
(or Ctrl+ Shift +N)
2. Choose “Visual Studio
Solutions” in left panel
3. Enter Name & location
solution => click OK
HO CHI MINH CITY UNIVERSITY OF INDUSTRY
Author: Duy Thanh Tran – Phone : 0987773061- Email: – Blog:
You can see “Solution1”
name in the right panel
HO CHI MINH CITY UNIVERSITY OF INDUSTRY
Author: Duy Thanh Tran – Phone : 0987773061- Email: – Blog:
How
To
add
New
Project:
2
1. Right click on Solution1
2. Choose Add item
3. Choose New Project
HO CHI MINH CITY UNIVERSITY OF INDUSTRY
Author: Duy Thanh Tran – Phone : 0987773061- Email: – Blog:
add
New
Project
Dialog
You can
choose any
Application
Type name
& click OK
HO CHI MINH CITY UNIVERSITY OF INDUSTRY
Author: Duy Thanh Tran – Phone : 0987773061- Email: – Blog:
Many
different projects
in the Solution
HO CHI MINH CITY UNIVERSITY OF INDUSTRY
Author: Duy Thanh Tran – Phone : 0987773061- Email: – Blog:
Problem: You don’t
know which Project
that you want to run
1. Right click on Project
2. Choose Set as
StartUp Project
HO CHI MINH CITY UNIVERSITY OF INDUSTRY
Author: Duy Thanh Tran – Phone : 0987773061- Email: – Blog:
Problem: We have
many Window
Computing Platform…
To any PC can run
your Application, you
must config as below
Right click
on Project
& choose
Properties
HO CHI MINH CITY UNIVERSITY OF INDUSTRY
Author: Duy Thanh Tran – Phone : 0987773061- Email: – Blog:
Or
Go to menu Project
=> Choose Project
properties
HO CHI MINH CITY UNIVERSITY OF INDUSTRY
Author: Duy Thanh Tran – Phone : 0987773061- Email: – Blog:
Project Properties dialog
1. Go to Build tab
2. Platform target
please choose
“Any CPU”
3. Save project
HO CHI MINH CITY UNIVERSITY OF INDUSTRY
Author: Duy Thanh Tran – Phone : 0987773061- Email: – Blog:
How to add New
Item in the Project
1.Right click on Project
2.Choose Add item
3.Choose New Item
HO CHI MINH CITY UNIVERSITY OF INDUSTRY
Author: Duy Thanh Tran – Phone : 0987773061- Email: – Blog:
Choose
any
item
Enter name and click
“Add” button