Setting Up Visual Studio

Although this guide is outdated as it specifies on how to setup a mod for Mod The Gungeon ( the old mod loader), it is still useful to setup the Visual Studio for Gungeon modding.

https://www.youtube.com/watch?v=XAHTSP8Xlrg&t=11s

Setup

Enable .NET 3.5 in your operating system by going to Control Panel > Programs and Features > Turn Windows Features on or off, and select ".NET Framework 3.5 (includes 2.0 and 3.0)"

Install Visual Studio 2022 Community at https://visualstudio.microsoft.com/downloads/ for your workloads, select “.NET desktop development” and “Game development with Unity”

For the individual components, choose these:

Once that is done, go to this link (https://github.com/SpecialAPI/BepInExExampleModItems), and download the files by clicking on the "Code" tab and pressing "Download ZIP".

Once you have downloaded it, unzip the file and place the folder into your "repos" folder (Usually found at C:\Users\YourName\source\repos)

Your file structure should now resemble something like this. Note that you can rename the folder your projects files are in, it doesn't have to be "BepInExExampleModItems-main"

Double-click the file called "Mod.sln". This will open your mod projects code. When you first open it, it is near-guaranteed that you will see a lot of errors, so do not panic. You will need to toggle some stuff for the errors to clear away.

To start, right-click the "References" tab on your side and select "Manage NuGet packages".

Select the "Browse tab".

Select the gear on the right side. (Circled in green)

A window like this should open up now.

Click the green plus button to create a new package, rename the new package to "BepInEx", and change the "Source" tab to this link: https://nuget.bepinex.dev/v3/index.json If you do not have a package that contains this link (https://api.nuget.org/v3/index.json), create a new package called "nuget.org" and use this link in the "Source" tab.

Once you have done that, Click Ok. Set your "package source" to "All".

If you have everything done right, you should now have no errors.

Now, go back to your module class.

Change "MOD NAME" to whatever the name of your mod is.

Note, Version should ALWAYS consist of ONLY 2 decimal points (for example, 1.1.4) as anything more OR less will not be accepted.

Now, replace the relevant parts of GUID. Note to NOT use any special characters or capital letters. each part of the GUID string represents a different thing. creator: replace this with the creators name, aka your name / whatever you refer yourself to online. etg: do NOT change this, this represents the name of the game that is being modded, aka Gungeon. modname: the name of your mod. TEXT_COLOR is a hex value of whatever color you want your mod to log in into the F2 console when it is loaded into the game.

Your strings should look like this.

An issue that can occur if you do not change your mods build name is that it will conflict with other mods. To fix this, go to the "Project" tab at the top and select "Mod Properties" at the very bottom.

Now, change the Assembly name and the Default namespace to a new name (preferably have both be identical)

Remember to save your project after with Ctrl + S. ALSO change any namespaces from your old default namespace name to the NEW one you just set. If you do not do this your mod will likely not build.

If your mod already contains an example item as well, go to the example items file, and change the file path there to have your new Default Namespace name (However I would personally name the Assembly and Default Namespace the same thing for convenience) instead of the old one.

To build your mod, go to the "Build" tab on the top of your screen and press "Build Solution" (The hotkey Ctrl + Shift + B or Ctrl + B will do the same thing)

To be able to run your mod, navigate to the "plugins" folder in Gungeons BepInEx files. (If you are using a mod manager like r2modman, go to Settings and select "Browse Profile Folder", and navigate to the plugins folder from there.) Create a new folder in the plugins folder (name doesn't really matter but for organization call it the name of your mod). You will be placing your mods .dll there (the dll is the file that will have all your code and stuff for your mod). To find the dll, go back to your mods project folder and open the "bin" folder.

From there, open the Debug folder. This folder will have a LOT of dll files, so make sure to only copy the one you will need. Build your project if you haven't already, and find the file which has the name of whatever you set your mods Assembly name to.

Copy, or love this .dll to where-ever your mod folder (The one that you made to put your mods dll in in the plugins folder) and place the dll into that folder. Since your mod uses Alexandria and MTGAPI as dependencies, make sure to download those properly as well. Now, run the game. (If you are using a mod manager make sure to run the game Modded.)

If you did everything right your mod should log the start up message into the F2 console.

Last updated