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.
csharp-basics/1.5-introduction-to-visual-...

4.4 KiB

marp paginate math theme title
true true mathjax buutti 1.5. Introduction to Visual Studio

Introduction to Visual Studio

Overview

  • Visual Studio 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, a separate code editor by Microsoft

Features

Projects and solutions

  • In Visual Studio, there are two key concepts, projects and solutions
  • 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
    • Creating a new project
  • 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

w:800

Default view in Visual Studio consists of three panels.

  1. Code editor
  2. Solution Explorer (CTRL+ALT+L) shows the files in the project
  3. Terminal (CTRL+Ö) for entering command line commands (e.g., for using Git)

Moving windows around

  • 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

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

Gotchas

  • Some actions are unavailable when your app is running
    • Deleting files
    • Adding new controllers

Reading