S&box Wiki

Revision Difference

Setting_up_Visual_Studio#563406

<cat>Code.Intro</cat> <title>Setting up Visual Studio</title> # Downloading and installing Visual Studio 2022 [Download Visual Studio 2022 Community](https://visualstudio.microsoft.com/downloads/) and install with the workload .NET desktop development, as well as ASP.NET workload for razor support. If you need additional guidance refer to the [official guide](https://docs.microsoft.com/en-us/visualstudio/install/install-visual-studio?view=vs-2022). <warning> S&box now uses .NET 9. Any other version will not work. If you are having issues, make sure your Visual Studio is updated and the .NET 9 SDK is installed. </warning> # Opening your projects The best way to get started is to press Open Solution from the editor or ( <key>CTRL</key> + <key>P</key> ). <upload src="2a1e9/8dd035baee938b7.png" size="5582" name="image.png" /> <upload src="2a1e9/8dd035bdb596d3e.png" size="7212" name="image.png" /> Your solution contains all the code from your game, tools, editor etc. # Troubleshooting * If you get a lot of errors from dependencies not being able to load, make sure you have the latest version of Visual Studio 2022 installed with .NET 9. ## Missing .NET 9⤶ Are you missing a .NET 9 SDK installation? Sometimes Visual Studio refuses to reference the .NET 7 SDK unless you have the preview channel enabled.⤶ * You can install it from [Microsoft .NET 9 Installation Package](https://dotnet.microsoft.com/en-us/download/dotnet/9.0). **Still unable to reference .NET 9?** Please change your Visual Studio 2022 Instance to the **Preview** Channel by following the guide below. <upload src="b4a78/8db7e4427dea7a9.png" size="77262" name="image.png" /> <upload src="b4a78/8db7e44497c9929.png" size="84165" name="image.png" /> **You should now see your .NET 9 installation when selecting an SDK.** <upload src="b4a78/8db7e4451717801.png" size="51947" name="image.png" /> # Debugging ⤶ For info on debugging check out the <page>Debugging</page> page.⤶ With the S&box editor running, use Debug|Attach to Process and attach to sbox-dev.exe. ⤶ ⤶ You can now set breakpoints in your code, and any exceptions should trigger the debugger. ⤶ ⤶ If your breakpoints remain disabled, you might need to enable the Visual Studio option Tools|Options|Debugging,General "Allow the source code to be different from the original."⤶ ⤶ <upload src="b5be6/8dd404b6f4a5fde.png" size="33252" name="image.png" />