Editing Modding Tutorials/Setting up a solution
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 12: | Line 12: | ||
Setting up can be different for different IDE's. Feel free to add '''''complete''''' instructions for your IDE of choice. | Setting up can be different for different IDE's. Feel free to add '''''complete''''' instructions for your IDE of choice. | ||
− | ===Visual Studio Community | + | ===Visual Studio Community 2017=== |
− | ''NOTE: Visual Studio | + | ''NOTE: Visual Studio 2017 is a rather heavy application (2-3 GB for basic functionality) but has a bit more functionality. Only Install if your computer can handle it! The tutorial is similar for Visual Studio 2015.'' |
Line 19: | Line 19: | ||
# Create a new class library project | # Create a new class library project | ||
## Once loaded, go to File -> New -> Project... | ## Once loaded, go to File -> New -> Project... | ||
− | ## | + | ## Go to Templates -> Visual C# -> Class Library (Be sure to select the *.NET Framework* version, not *.NET Standard*) [[File:Capture.png|200px|thumb|right|Installing the .NET framework]] |
− | ## Enter your | + | ## Enter your name and solution name in the lower pane. |
## Choose a location, preferably:<br/><pre>(RimWorldInstallFolder)/Mods/(YourModName)/Source</pre> | ## Choose a location, preferably:<br/><pre>(RimWorldInstallFolder)/Mods/(YourModName)/Source</pre> | ||
− | ## | + | ## ''Optional'': Untick "Create directory for solution" |
− | + | # In your project, set target framework and various other porperties | |
− | # In your project, set target framework and various other | + | ## In your Solution Explorer, right click your project -> Properties |
− | ## In your Solution Explorer | + | ## Once in your properties, select Application -> Set Target Framework to .NET Framework 3.5 (No client profile) |
− | ## ''Optional'': | + | ## ''Optional'': Change your Assembly and Namespace names to anything of your choice |
## Go to Build -> Advanced... and set "Debugging information" to none | ## Go to Build -> Advanced... and set "Debugging information" to none | ||
− | ## Leave Advanced..., and set the Output Path to "..\..\Assemblies\" ( | + | ## Leave Advanced..., and set the Output Path to "..\..\Assemblies\" (The Assemblies folder in your mod folder) |
# Add references to RimWorld code | # Add references to RimWorld code | ||
− | ## Expand your project | + | ## Expand your project. Then right click "References" -> Add Reference... |
## Click Browse... | ## Click Browse... | ||
− | ## Navigate towards <pre> | + | ## Navigate towards <pre>RimWorld******/RimWorld******_Data/Managed</pre> and select files: <br/><pre>Assembly-CSharp.dll UnityEngine.dll</pre> |
## Click "Add" | ## Click "Add" | ||
− | + | ## Right click on both Assembly-CSharp.dll and UnityEngine.dll and set Copy Local to False (Properties pane). | |
− | ## Right | ||
− | ====Option 2 ( | + | ====Option 2 (Automatic Method):==== |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
# Open Visual Studio | # Open Visual Studio | ||
# Once loaded, go to File -> New -> From Cookiecutter... | # Once loaded, go to File -> New -> From Cookiecutter... | ||
Line 92: | Line 63: | ||
## In your IDE project file browser, right-click the "References" folder and "Add reference"; | ## In your IDE project file browser, right-click the "References" folder and "Add reference"; | ||
## Choose the ".NET Assembly Browser" tab and "Browse..."; | ## Choose the ".NET Assembly Browser" tab and "Browse..."; | ||
− | ## Navigate towards <pre>RimWorld******/RimWorld******_Data/Managed</pre> and select files: <br/><pre>Assembly-CSharp.dll UnityEngine | + | ## Navigate towards <pre>RimWorld******/RimWorld******_Data/Managed</pre> and select files: <br/><pre>Assembly-CSharp.dll UnityEngine.dll</pre> |
## Click "Open" then "OK"; | ## Click "Open" then "OK"; | ||
## In the References folder, right-click Assembly-CSharp -> Properties and change "Local copy" to False. Do the same for UnityEngine, | ## In the References folder, right-click Assembly-CSharp -> Properties and change "Local copy" to False. Do the same for UnityEngine, | ||
− | # In your project properties, change the target framework to .NET | + | # In your project properties, change the target framework to .NET 3.5: |
## In your IDE project file browser, right-click "(YourSolutionName)"; | ## In your IDE project file browser, right-click "(YourSolutionName)"; | ||
## Choose Properties; | ## Choose Properties; | ||
− | ## Go to the "Compiling" tab, "Output", "Target framework", "Change" and choose ".NET Framework | + | ## Go to the "Compiling" tab, "Output", "Target framework", "Change" and choose ".NET Framework 3.5", |
# In your project properties, change the build events so only a single file is built: | # In your project properties, change the build events so only a single file is built: | ||
## Go to the "Compiling" tab, "Output", "Debug info" and choose "No debug information"; | ## Go to the "Compiling" tab, "Output", "Debug info" and choose "No debug information"; | ||
Line 105: | Line 76: | ||
## Go to the "Compiling" tab, "Output", "Output path" and change the output path to "..\..\Assemblies\".<br/><br/> | ## Go to the "Compiling" tab, "Output", "Output path" and change the output path to "..\..\Assemblies\".<br/><br/> | ||
− | ===Xamarin | + | ===Xamarin=== |
The setup is similar as the one above. A few special points to address: | The setup is similar as the one above. A few special points to address: | ||
− | # Mono 4.X isn't backward compatible so you may need to install an older 3.X version of Mono in order to compile against . | + | # Mono 4.X isn't backward compatible so you may need to install an older 3.X version of Mono in order to compile against .NET3.5 dlls. |
− | # Make sure you uncheck "Use MSBuild build engine (recommended for this project type)" under project > options > build > general | + | # Make sure you uncheck "Use MSBuild build engine (recommended for this project type)" under project > options > build > general |
− | |||
− | |||
− | + | ===Rider (good for on Mac)=== | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | ===Rider (good for Mac)=== | ||
JetBrains Rider is a great cross-platform C# IDE, but it isn't cheap. It's $140 for the first year, including perpetual access to that version (access to future updates gets cheaper, but it's still over $100/year). However, the Early Access versions are a bit unstable but free. They also offer free student licenses. | JetBrains Rider is a great cross-platform C# IDE, but it isn't cheap. It's $140 for the first year, including perpetual access to that version (access to future updates gets cheaper, but it's still over $100/year). However, the Early Access versions are a bit unstable but free. They also offer free student licenses. | ||
Line 131: | Line 90: | ||
## Set the Solution Directory to [your mod folder]/Source. | ## Set the Solution Directory to [your mod folder]/Source. | ||
## Optionally check "put solution and project in the same directory." This is probably a good idea. | ## Optionally check "put solution and project in the same directory." This is probably a good idea. | ||
− | ## Change Framework to .Net Framework | + | ## Change Framework to .Net Framework 3.5. |
## Click Create. | ## Click Create. | ||
# In the left side bar, expand your solution, right click your project (mod name with "C#" icon) and click Properties. | # In the left side bar, expand your solution, right click your project (mod name with "C#" icon) and click Properties. | ||
Line 146: | Line 105: | ||
You're done! Note that Rider has a built-in decompiler—to view the source of a RimWorld class or method, just right-click its name and click Go To > Definition. | You're done! Note that Rider has a built-in decompiler—to view the source of a RimWorld class or method, just right-click its name and click Go To > Definition. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
=See also= | =See also= |