Skip to content

Instantly share code, notes, and snippets.

@rbento
Last active May 4, 2024 03:38
Show Gist options
  • Save rbento/79a70525bb2f1ec034811afb06b69aa5 to your computer and use it in GitHub Desktop.
Save rbento/79a70525bb2f1ec034811afb06b69aa5 to your computer and use it in GitHub Desktop.
Notes on Visual Studio 2019

Microsoft Visual Studio Community

Editor Settings

Generate .editconfig from VS Settings

# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Baseline
[*]
charset = utf-8
indent_style = tab
indent_size = 4
insert_final_newline = true
max_line_length = 120
tab_width = 4
trim_trailing_whitespace = true

# MSBuild
[*.{csproj,proj,projitems,shproj,fsproj,target,props}]
indent_style = space
indent_size = 2

# XML config files
[*.{config,nuspec,resx,natvis}]
indent_style = space
indent_size = 2

# Python files
[*.py]
indent_style = space
indent_size = 4

# YAML files
[*.yaml]
indent_style = space
indent_size = 2

Project Settings

General Project Settings For Projects With Libraries

  • Configuration Properties
    • General

      • Output Directory
        • $(SolutionDir)Build\$(Platform)\$(Configuration)\
      • Intermediate Directory
        • $(SolutionDir)Build\Intermediate\$(Platform)\$(Configuration)\
    • Linker

      • Input
        • Additional Dependencies

          • opengl32.lib
          • glew32s.lib
          • glfw3.lib
        • Ignore Specific Default Libraries

          • libcmt.lib
          • msvcrt.lib
    • VC++ Directories

      • Include Directories

        • $(SolutionDir)Resources\Libraries\glew-2.1.0\include
        • $(SolutionDir)Resources\Libraries\glfw-3.3.4\include
      • Library Directories

        • $(SolutionDir)Resources\Libraries\glew-2.1.0\lib\x64
        • $(SolutionDir)Resources\Libraries\glfw-3.3.4\lib\x64
    • Build Events (Optional)

      • Post-Build Event
        • Command Line
          • copy $(SolutionDir)Resources\Libraries\glew-2.1.0\lib\x64*.dll $(SolutionDir)Build$(Platform)$(Configuration)\
          • copy $(SolutionDir)Resources\Libraries\glfw-3.3.4\lib\x64*.dll $(SolutionDir)Build$(Platform)$(Configuration)\

General Settings For Detailed Program Analysis


Inspect Preprocessed File, Generates file.i

  • Configuration Properties
    • C/C++
      • Preprocessor
        • Preprocess to a file
          • Yes (/P)

Inspect Generated Assembly Code, Generates file.asm

  • Configuration Properties
    • C/C++
      • Output Files
        • Assembler Output
          • Assembly With Machine Code and Source Code (/FAcs)

Set Maximum Optimization

  • Configuration Properties
    • C/C++
      • Optimization

        • Maximum Optimization (Favor Speed) (/O2)
      • Code Generation

        • Basic Runtime Checks
          • Default

Shortcuts

Navigation

Global Search
Ctrl + Q

Solution Explorer Search
Ctrl + ;

Symbol Search
Ctrl + ,

Incremental Search
Ctrl + I, then F3 To Navigate Results

Search Word Under Cursor
Next Ctrl + F3, Previous Ctrl + Shift + F3

Go To Line
Ctrl + G

Go To All
Ctrl + T

Go To Member
Alt + \

Go To File
Ctrl + Shift + T

Go To Last Edited Location
Ctrl + Shift + Backspace

Go Previous/Next Cursor Location
Previous Ctrl + -, Next Ctrl + Shift + -

View Call Hierarchy
Ctrl + K, Ctrl + T

View Todo List
Ctrl + \, T

Code Editor

Rename Symbol
Ctrl + R, Ctrl + R

Duplicate Line
Ctrl + D

Delete Line
Ctrl + L

New Line Above
Ctrl + Enter

New Line Below
Ctrl + Shift + Enter

Show/Hide Whitespace
Show Ctrl + R, Hide Ctrl + W

Show Parameter List
Ctrl + Shift + Space

Place Cursor At The Same Column In Multiple Lines
Alt + Shift + Arrow

Select Block Region
Left Mouse Click The Initial Position, then Alt + Shift + Left Mouse Click Target Position

Place Multiple Cursors In Alternate Locations
Ctrl + Alt + Left Mouse Click

Build

Compile Current File (No Linking)
Ctrl + F7

Build Project
Ctrl + B

Build Solution
Ctrl + Shift + B

Code Formatting

Format Document
Ctrl + K, Ctrl + D

Format Selection
Ctrl + K, Ctrl + F

Context Menus

Special Context Menu
Alt + `

IntelliSense
Ctrl + J

Quick Actions
Ctrl + .

Snippets
Ctrl + K, Ctrl + X

Debugging

Add/Remove Breakopint
F9

Add/Remove Function Breakpoint
Ctrl + K, B

Remove all Breakpoints
Shift + F9

Go To Next Statement
Alt + Num *

Step Into
F11

Step Over
F10

Step Out
Shift + F11

Show Immediate Window
Ctrl + Shift + I

Show Output Window
Ctrl + Alt + O

Show Breakpoints Window
Ctrl + Alt + B

Show Call Stack Window
Ctrl + Alt + C

XNA Game Studio


Fix Microsoft.Build.Framework.dll not found.

Open the Developer Command Prompt for VS 2019 as an administrator:

cd "\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin"

gacutil /i Microsoft.Build.Framework.dll

Autocomplete On Enter Key

  • Tools > Options > Text Editor > C/C++ > Advanced > IntelliSense > Member List Commit Aggressive = True

Prevent Stealing Editor Focus

  • Tools > Options > Project and Solutions > General > Disable : Show Output window when build starts

Prevent Stealing Other Active Windows's Focus

  • Tools > Options > Debugging > General > Disable : Bring Visual Studio to the foreground when breaking in the debugger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment