Visual Studio Intro
This intro is a quick reference and it should help you to familiarise quickly with the key and essential Visual Studio (VS) functionality.
The VS Integrated Development Environment (IDE) might look overwhelming in the beginning but there is no need to know everything. More you work with VS you will start discovering what you need and you will eventually understand the complexity of VS by passive learning.
Initial notes:
- You should already be familiar with any coding/development IDE
- This is not a tutorial, this is a quick reference on what is the most important or helpful to know when you start working with Visual Studio. Do check any available material to familiarise and learn if you don't understand this guide
- If you don't know certain terms just google them
Content π
- 1. Solution vs Project
- 2. Opening Solution / Project
- 3. Solution Explorer
- 4. Windows Management
- 5. F12 is your friend - Go to Definition
- 6. CTRL+T and CTRL+Q - Search Everywhere
- 7. dotnet command
- 8. Project story - Viewing csproj in summary
- 9. Project Packages (nuget)
- 10. Visual Studio Extensions
- 11. Visual Studio Settings
- Q&A
1. Solution vs Project π
Solution contains 1 or more projects to logically organise your projects together.
2. Opening Solution / Project π
You can open a project by clicking on a file with extension .sln (solution) or .csproj (C# project). If you open a project which is part of a solution, the solution might open instead automatically.
3. Solution Explorer π
Once you open your Solution or Project you want to see your Solution Explorer which contains a logical hierarchy of all folders and files which are needed to build your project. You are going to use this window and navigate through it very frequently. Usually you would have your Solution Explorer on the right or on the left always visible.
Note: If you cannot see it go to Menu β View β Click Solution Explorer (first in the menu)
4. Windows Management π
You might use these options below frequently to arrange your windows. More info about customising layouts.
-
Vertical Document Group - If you need to see different files next to each other
-
Horizontal Document Group - If you need to see different files horizontally
-
Split Window - You can split horizontally the edition of a file through Window β Split. This is especially useful when visualizing or editing two locations in a large file
-
New Window - Open an instance of the same file in a separate window, Window β New Window
5. F12 is your friend - Go to Definition π
The Go To Definition feature navigates to the source of a type or member, and opens the result in a new tab.
- Pressing F12 while your text cursor is somewhere inside the symbol name
- Right click mouse on the symbol β Go to Definition
- Or ALT+F12 to peek the identifier definition without opening a new tab
6. CTRL+T and CTRL+Q - Search Everywhere π
- CTRL+Q - Search everywhere in the code, including menu items
- CTRL+T - Search everywhere in the code
7. dotnet command π
- It provides commands for working with .NET projects
- e.g.
dotnet build
builds a project - e.g.
dotnet --info
shows detailed information about a .NET installation
- e.g.
- It runs .NET applications
- e.g.
dotnet myApplication.exe
ordotnet myApplication.dll
- e.g.
8. Project story - Viewing csproj in summary π
.NET projects are based on the MSBuild format. Project files, which have extensions like .csproj for C# project are in XML format. The csproj file includes settings related to targeted .NET Frameworks, project folders, NuGet package references etc.
You can edit in 2 ways
- Solution Explorer β Select your project β Right Click β Select Edit Project File
- Solution Explorer β Double click on the project name
9. Project Packages (nuget) π
An essential tool for any modern development platform is a mechanism through which developers can create, share, and consume useful code. Often such code is bundled into "packages" that contain compiled code (as DLLs) along with other content needed in the projects that consume these packages (source An introduction to Nuget).
For .NET (including .NET Core), the Microsoft-supported mechanism for sharing code is NuGet (essentially a single ZIP file) with the .nupkg extension.
- Solution Explorer β Right click on Projectβ Manage Nuget Packages
- Browse - Search for new packages
- Installed - See your installed packages
- Updates - See current updates for your installed packages (mind minor vs major updates)
10. Visual Studio Extensions π
Extensions allow you to customize and enhance your experience in Visual Studio by adding new features or integrating existing tools (Amazon, Azure, ..). The main purpose is to increase your productivity and cater to your workflow.
- Top Menu β Extensions β Manage Extensions
- Installed - All installed and pre-installed extensions
- Online - Search for new extensions
- Updates - Update extensions, some extensions update automatically
- Roaming Extensions Manager - If you are logged into Visual Studio with your Microsoft account you can sync your extensions to other devices with Visual Studio
- Top free extensions for development
- CodeMaid
- Productivity Power Tools 2019/2022 - Installs a few individual extensions for your productivity
- Live Share - Real-time collaborative development in Visual Studio and Visual Studio Code
- Web Essentials 2019/2022 - Installs a few individual extensions for your web development
- AWS Toolkit - If you work/deploy to AWS
11. Visual Studio Settings π
- Top Menu β Edit β Advance β Word Wrap
- Very useful so you don't need to move your horizontal bar
- Top Menu β Toolsβ Options β Projects and Solutions β Track Active Item in Solution Explorer -
- Solution Explorer item is selected automatically when you edit the file in the Editor
- Top Menu β Toolsβ Options β Productivity Power Tools (Extension) β Power Commands β Remove and Sort Using on save
Q&A π
Q: How to create a new project within the solution? π
A1: Solution Explorer β Right click on Solution β Add β New project or Existing Project
A2: Top Menu β File β Add β New project or Existing Project
Q: How to change the .NET version? π
A1: Double click on the project file to open the project as XML and edit the <TargetFramework>net5.0</TargetFramework>
tag.
A2: Solution Explorer β Right Click on the Project β Click Properties β Click Application β Change Target Framework
C#Visual StudioBeginner
Any comments? You can start π¨ at GitHub Discussions. Edit this page on .