S&box Wiki
Home
/
Edit Setting up Visual Studio Code
View
Edit
History
No Category
Developer Overview
The Project System
Publishing To Asset Party
Getting Started With Hammer
Mapping Basics
Mapping Entities
Advanced Mapping Techniques
Getting Started with Modeldoc
Animgraph & Animation
Physics
Modeldoc Nodes
Advanced Modelling
UI Basics
Styles & Stylesheets
Razor Templates
Game Menus
Materials
Built In Shaders
Shaders
Shader Reference
Sounds & Audio
Particles
Getting Started
Making Games
Input
Networking
Physics
Rendering
Editor & Tools
VR
Misc
Playing Guides
Console Commands & Variables
Dedicated Server
Log in to edit
Setting up Visual Studio Code
<cat>Code.Intro</cat> <title>Setting up Visual Studio Code</title> <warning>Additional configuration is required for Visual Studio Code to work fully, make sure you read the entire article.</warning> # Installation and setup * [Download & install Visual Studio Code](https://code.visualstudio.com/) * [Download & install .NET 7 SDK](https://dotnet.microsoft.com/download/dotnet/7.0) * [Download & install C# Extension](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp) ## Enable Roslyn analyzers You need to enable Roslyn analyzers if they are not already, without this you will get reference errors. The simplest way is File -> Preferences -> Settings, from there search for "roslyn" and tick the setting "Enable Roslyn Analyzers". <upload src="a5727/8d96338ca87e4b8.png" size="12823" name="image.png" /> Be sure to save your settings. ## Add a solution to the project directory Because s&box generates a `.sln` file in the s&box app directory rather than your game project directory, VS Code will have no solution to load, and will instead load your game's `.csproj` on its own, which will prevent it from resolving references to classes from `sbox/addons/base/code/Base Library.csproj`. To fix this, configure the s&box editor to use VS rather than VS Code in `Edit -> Preferences`, generate and open the solution using `Game -> Open in Visual Studio` with your game project open in the editor, and save the solution to your project directory. You can then set your preferred code editor back to VS Code and develop as normal with fully working Intellisense. # Opening projects After [creating your game project](https://wiki.facepunch.com/sbox/Games/GettingStarted), you can open your addon folder in VSCode via `File -> Open Folder...`. <upload src="a5727/8d963395a10fc3e.png" size="8076" name="image.png" /> You can also open the project directly from the S&box Editor by clicking `File -> Open Solution`. ## Adding debugger configuration We need to add a debugging configuration to debug addons. Create the following file in your addon directory `.vscode\launch.json`: ```cs { "version": "0.2.0", "configurations": [ { "name": ".NET Core Attach", "type": "coreclr", "request": "attach", "processName": "sbox.exe", // or sbox-dev.exe "requireExactSource": false // makes sure you can debug stuff with codegen (e.g entities) } ] } ``` You can now start debugging your addons by setting breakpoints and pressing F5: ![](https://i.imgur.com/NqxzROM.gif) Keep in mind that you need to manually start s&box first before debugging. # Recommended extensions [Visual Studio Keymap](https://marketplace.visualstudio.com/items?itemName=ms-vscode.vs-keybindings): Adds Visual Studio keymaps in case you are used to Visual Studio shortcuts. [JetBrains Keymap](https://marketplace.visualstudio.com/items?itemName=isudox.vscode-jetbrains-keybindings): Adds JetBrains keymaps in case you are used to JetBrains shortcuts. [EditorConfig for VS Code](https://marketplace.visualstudio.com/items?itemName=editorconfig.editorconfig): Automatically format your code with the s&box coding style [SCSS Formatter](https://marketplace.visualstudio.com/items?itemName=sibiraj-s.vscode-scss-formatter): Automatically format your scss files. [vscode-solution-explorer](https://marketplace.visualstudio.com/items?itemName=fernandoescolar.vscode-solution-explorer): Visual Studio-like solution explorer for Visual Studio Code. [C# Snippets](https://marketplace.visualstudio.com/items?itemName=jorgeserrano.vscode-csharp-snippets): C# code snippets. [Auto-Using for C#](https://marketplace.visualstudio.com/items?itemName=fudge.auto-using): Auto import namespaces. [C# Extensions](https://marketplace.visualstudio.com/items?itemName=tdallau-csharpextensions.csharpextensions): Quickly create new classes and generate constructors. [C# Namespace Autocompletion](https://marketplace.visualstudio.com/items?itemName=adrianwilczynski.namespace): IntelliSense for writing namespaces. [C# XML Documentation Comments](https://marketplace.visualstudio.com/items?itemName=k--kato.docomment): Easier code documentation. [GitLens](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens): A useful extension when working with Git.
S&box Wiki
Development
Developer Overview
6
Editor Overview
General FAQ
System Requirements
The s&box wiki
Troubleshooting
Useful Links
The Project System
4
Adding Assets
Creating a Game Project
Project Settings Window - Games
Project Types
Publishing To Asset Party
2
Uploading assets
Uploading projects
Hammer
Getting Started With Hammer
3
Getting Started With Hammer
Making Your First Map
Mapping Resources
Mapping Basics
7
Cordons
Hotspot Materials
Selection Sets
Standard Mapping Dimensions
Tool Materials
Tools Visualisation Modes
Using Entities That Require a Mesh
Mapping Entities
2
Creating a Door
Light Entities
Advanced Mapping Techniques
8
Collaborating With Prefabs and Git
Instances
Prefabs
Quixel Bridge Plugin
Tilesets
Tilesets-Advanced
Tilesets-Proxies
VIS Optimizations
Models & Animation
Getting Started with Modeldoc
7
Automatic Model Setup
Breakpieces
Creating a Model
Guide to Models
Importing Rust Weapons
LODs
ModelDoc FAQ & best practices
Animgraph & Animation
4
Animations without Animgraph
AnimEvents, AnimGraph Tags, Attachments
Animgraph
Delta Animations
Physics
3
Cloth Physics
Collisions, Physics & Surface Types
Jiggle Bones
Modeldoc Nodes
1
Custom ModelDoc nodes
Advanced Modelling
6
Bodygroups
Citizen
First Person
IKChains and Stride Retargeting
Morphs
Vertex Normals
User Interface
UI Basics
7
Custom Fonts
Embedding Websites
Enabling Pointer Events
Events and Input
Localization
UI Basics
UI with Components
Styles & Stylesheets
0
Razor Templates
3
A Razor Overview
Generic Components
Templates
Game Menus
1
Making a Custom Pause Screen
Materials & Shaders
Materials
5
Guide to Materials
Material Attributes
Material Resources
Texture Settings
Using Dynamic Expressions
Built In Shaders
2
Foliage Shader
Glass Shader
Shaders
4
Compute Shaders
Constant Buffers
Material API
Shading Model
Shader Reference
5
Anatomy of Shader Files
Getting rid of Tex2D macros
Shader Reference
Shader States
Texture Format Cheat-Sheet
Other Assets
Sounds & Audio
3
Guide to Sounds
Sound Events
Soundscapes
Particles
5
Creating animated sprites
Creating your first particle effect
Understanding Particle Editor
Using custom sprites
Using particle systems from C#
Coding
Getting Started
5
Cheat Sheet
Learning Resources
Setting up Rider
Setting up Visual Studio
Setting up Visual Studio Code
Making Games
2
Components
GameObjects
Input
4
Commands
ConVars
Input System
Speech Recognition
Networking
8
Auth Tokens
Http Requests
Lobby System
Networked Types
Networking Basics
RPCs
Setting Up Networking
WebSockets
Physics
4
Collisions
Hitboxes
Traces
Triggers
Rendering
3
Render Tags
RenderHooks
Scenes
Editor & Tools
7
Creating a Tool
Custom Asset Types
Guide to Widgets
Hammer API
Hammer Gizmos
Hotload Performance
Widget Docking
VR
3
Getting Started
VR Input
VR Overlays
Misc
13
Asset Types
Attributes and Component Properties
Backend API
Cloud Assets in code
Code Accesslist
CPU Performance Profiling
DisplayInfo
FileSystem
Mounting assets at runtime
package/find
Setting Up A Navigation Mesh
Threaded Tasks
TypeLibrary
Playing
Playing Guides
3
Default Keybinds
Proton
s&box on macOS (Experimental)
Console Commands & Variables
1
Launch Arguments
Dedicated Server
1
Dedicated Servers