You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
111 lines
4.4 KiB
Markdown
111 lines
4.4 KiB
Markdown
---
|
|
marp: true
|
|
paginate: true
|
|
math: mathjax
|
|
theme: buutti
|
|
title: 1.5. Introduction to Visual Studio
|
|
---
|
|
|
|
# Introduction to Visual Studio
|
|
|
|
<!-- headingDivider: 5 -->
|
|
<!-- class: invert -->
|
|
|
|
## Overview
|
|
|
|
* [Visual Studio](https://visualstudio.microsoft.com/) An IDE (Integrated development environment) by Microsoft for Windows
|
|
* Used for C#, C++, etc
|
|
* There's a free Community edition
|
|
* Multiple versions released
|
|
* First version: 1997
|
|
* 2017, 2019, 2022...
|
|
* Not to be confused with [Visual Studio Code](https://code.visualstudio.com/), a separate code editor by Microsoft
|
|
|
|
## Features
|
|
|
|
* [Debug tools](https://learn.microsoft.com/en-us/visualstudio/debugger/?view=vs-2022)
|
|
* [Build tools](https://learn.microsoft.com/en-us/visualstudio/ide/compiling-and-building-in-visual-studio?view=vs-2022)
|
|
* [IntelliSense](https://learn.microsoft.com/en-gb/visualstudio/ide/visual-csharp-intellisense?view=vs-2022)
|
|
* code completion aid
|
|
* automatic code generation
|
|
* [GitHub Copilot](https://learn.microsoft.com/en-us/visualstudio/ide/visual-studio-github-copilot-extension?view=vs-2022) and [IntelliCode](https://learn.microsoft.com/en-us/visualstudio/ide/intellicode-visual-studio?view=vs-2022), AI-assisted code development in VS
|
|
* [Git integration](https://learn.microsoft.com/en-us/visualstudio/version-control/git-with-visual-studio?view=vs-2022)
|
|
* [Testing tools](https://learn.microsoft.com/en-us/visualstudio/test/?view=vs-2022)
|
|
* [Profiling and diagnostics tools](https://learn.microsoft.com/en-us/visualstudio/profiling/?view=vs-2022)
|
|
|
|
## Projects and solutions
|
|
|
|
* In Visual Studio, there are two key concepts, ***projects*** and ***solutions***
|
|
* Here's Microsoft's documents for [what they are](https://learn.microsoft.com/en-us/visualstudio/ide/solutions-and-projects-in-visual-studio?view=vs-2022&source=recommendations) and [how to create them](https://learn.microsoft.com/en-gb/visualstudio/get-started/tutorial-projects-solutions?view=vs-2022)
|
|
* A ***project*** contains all files that are compiled into an executable application
|
|
* Source code, images, data files, etc
|
|
* Compiler settings, configuration files
|
|
* In C#, handled by the project file `.csproj` by [MSBuild](https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild?view=vs-2022)
|
|
* [Creating a new project](https://learn.microsoft.com/en-us/visualstudio/ide/create-new-project?view=vs-2022)
|
|
* A ***solution*** contains one or multiple projects
|
|
* Build information, Visual Studio window settings
|
|
* Files that aren't associated with a particular project
|
|
* `.sln` is the solution file, `.suo` contains Solution User Options
|
|
|
|
## Visual Studio UI
|
|
|
|
<div class='columns32' markdown='1'>
|
|
<div markdown='1'>
|
|
|
|

|
|
|
|
</div>
|
|
<div markdown='1'>
|
|
|
|
Default view in Visual Studio consists of three panels.
|
|
1) Code editor
|
|
2) [Solution Explorer](https://learn.microsoft.com/en-us/visualstudio/ide/use-solution-explorer?view=vs-2022) (*CTRL+ALT+L*) shows the files in the project
|
|
3) **_Terminal_** (*CTRL+Ö*) for entering command line commands (e.g., for using Git)
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
## Moving windows around
|
|
|
|
<div class='columns' markdown='1'>
|
|
<div markdown='1'>
|
|
|
|
* Drag and hold windows to move them around
|
|
* _Snap to layout_ window appears
|
|
* After moving a window to the right, you can pin it to see its title on the right
|
|

|
|
|
|
</div>
|
|
<div markdown='1'>
|
|
|
|

|
|
|
|
</div>
|
|
</div>
|
|
|
|
## Keyboard shortcuts
|
|
|
|
* *CTRL+.*
|
|
* If a type is missing, use this to add the needed using directive
|
|
* *CTRL+R*, then *CTRL+R* (seriously?)
|
|
* Rename variable
|
|
* Press Enter to confirm
|
|
* *CTRL+C* (without selecting), then *CTRL+V*
|
|
* Duplicate line
|
|
* *ALT+Up*, *ALT+Down*
|
|
* Move line up/down
|
|
* [Visual Studio Default keyboard shortcuts](https://visualstudio.microsoft.com/vs/features/develop/)
|
|
|
|
## Gotchas
|
|
|
|
* Some actions are unavailable when your app is running
|
|
* Deleting files
|
|
* Adding new controllers
|
|
|
|
## Reading
|
|
|
|
* [Visual Studio Documentation: Overview](https://learn.microsoft.com/en-gb/visualstudio/get-started/visual-studio-ide?view=vs-2022)
|
|
* [Visual Studio tutorials | C#](https://learn.microsoft.com/en-us/visualstudio/get-started/csharp/?view=vs-2022)
|
|
* [Tutorial: Create a .NET console application using Visual Studio](https://learn.microsoft.com/en-gb/dotnet/core/tutorials/with-visual-studio) |