Difference between revisions of "Modding Tutorials/Setting up a solution"

From RimWorld Wiki
Jump to navigation Jump to search
(Split from "Writing custom code")
 
(Added category and back button)
Line 1: Line 1:
 +
{{BackToTutorials}}
  
 
# Create a new class library project in your [[Modding Tutorials/Recommended software#IDE.27s|IDE of choice]];
 
# Create a new class library project in your [[Modding Tutorials/Recommended software#IDE.27s|IDE of choice]];
Line 22: Line 23:
 
# In your project properties, fix the output location to put the DLL in the Assemblies folder:
 
# In your project properties, fix the output location to put the DLL in the Assemblies folder:
 
## Change the output path to "..\..\Assemblies\".
 
## Change the output path to "..\..\Assemblies\".
 +
 +
 +
[[Category:Modding tutorials]]

Revision as of 10:55, 22 August 2015

Modding Tutorials

  1. Create a new class library project in your IDE of choice;
    1. Go to File -> New -> Solution;
    2. Go to C# or .NET -> Library or Class Library (NOT portable);
    3. Enter a project name (solution name automatically updated);
    4. Choose a location, preferably:
      (RimWorldInstallFolder)/Mods/(YourModName)/Source
    5. Untick "Create a directory for solution"/"Create a project within the solution directory",
  2. In your project, add references to Assembly-CSharp.dll and UnityEngine.dll:
    1. Copy these files:
      (RimWorldInstallFolder)/RimWorld_Data/Managed/Assembly-CSharp.dll
      (RimWorldInstallFolder)/RimWorld_Data/Managed/UnityEngine.dll
    2. Place them in your project:
      (RimWorldInstallFolder)/Mods/(YourModName)/Source/(YourSolutionName)/Source-DLLs
    3. In your IDE project file browser, right-click the "References" folder and "Add reference";
    4. Choose the ".NET Assembly Browser" tab and "Browse", go to the folder you placed the copied DLLs;
    5. Choose both DLLs and click OK,
  3. In your project properties, change the target framework to .NET 3.5:
    1. In your IDE project file browser, right-click Solution (YourSolutionName);
    2. Choose Properties;
    3. Go to the "Compiling" tab, "Output", "Target framework", "Change" and choose ".NET Framework 3.5",
  4. In your project properties, change the build events so only a single file is built:
    1. Change the debug info to "No debug information";
    2. In the References folder, right-click Assembly-CSharp -> Properties and change "Local copy" to False. Do the same for UnityEngine;
    3. Right-click your .cs files -> Properties and change "Copy to out" to Never,
  5. In your project properties, fix the output location to put the DLL in the Assemblies folder:
    1. Change the output path to "..\..\Assemblies\".