S&box Wiki

Revision Difference

Setting_up_Visual_Studio#545861

<cat>Code.Intro</cat> <title>Setting up Visual Studio</title> ⤶ <note>If you already have Visual Studio installed, make sure you have the latest version (at minimum 16.8) as newer versions contain the required .NET 5 SDK and Roslyn analyzers used by s&box.</note>⤶ # Downloading and installing Visual Studio 1. Download Visual Studio 2019 Community [here](https://visualstudio.microsoft.com/downloads/) 2. Run the installer 3. Select `.NET desktop development`. 3a. Optionally you can untick unwanted features on the right side. The ones suggested in the picture below should be sufficient. <upload src="3dc48/8d91deeb8920172.png" size="164967" name="image.png" /> After the installer has finished, you are now ready to work with S&box using Visual Studio! If you're new to C#, check out the <page text="C# Learning Resources">CSharp learning resources</page> to find resources that work for you. For information on how to create your first gamemode, follow the tutorial on <page text="making a gamemode">Making Gamemode</page>. # Generating your solution A solution file is automatically generated when you launch the game, you can find this solution next to your game directory. ``` C:/Steam/steamapps/common/sbox/s&box.sln ``` <upload src="a5727/8d9398753b3da50.png" size="8056" name="image.png" /> This is a solution file you can open in Visual Studio, this solution contains all your addons as projects. <upload src="a5727/8d939875bdc9091.png" size="10341" name="image.png" /> Each time you <page text="create a new addon">Making_Gamemode</page> you will need to restart your game to re-generate the solution. # Troubleshooting * If you get a lot of errors from dependencies not being able to load, make sure you have the [.NET 5 SDK](https://dotnet.microsoft.com/download/dotnet/5.0) installed. (This should be installed by default in a fresh install) * If you get a lot of errors from dependencies not being able to load, make sure you have the latest version of Visual Studio installed. # Extensions Visual Studio is an IDE with a lot of pre-installed tools, however if you find that you need something that it doesn't include, you can browse the extension manager. 1. Click on `Extensions` on the toolbar and select `Manage Extensions` <upload src="3dc48/8d91deb8f080128.png" size="17914" name="image.png" /> 2. The Extension Manager should now appear and you can search for extensions. If you want more information about a certain extension, click on the blue `More Information` text, and your browser will open a tab to the extension's page. <upload src="3dc48/8d91deba36fdf3f.png" size="81341" name="image.png" /> ## Community Extensions * [s&box Tools](https://marketplace.visualstudio.com/items?itemName=rtm516.sboxtools) (Adds some of the features in the external console to the IDE) # Debugging For info on debugging check out the <page>Debugging</page> page.