Setting Up Visual Studio¶
Install Visual Studio 2013¶
If you don’t own a copy of Visual Studio 2013, you can download Visual Studio Community 2013 for free. Installing Visual Studio should be straightforward.
Create a new solution and project¶
- Start Visual Studio
- Select the Class Library template for the Visual C# language (other .NET languages should work, but I haven’t tried that)
- Enter a name for your project
- Choose any location you’d like for your project, but don’t use the mod directory
- Click OK to create the solution
- Right-click your project in the Solution Explorer and choose
- Click the Browse… button at the bottom of the dialog
- Navigate to
[SteamLibrary]is the path where your Steam games are.
- Select the assembly DLL(s) you want to use.
Create your base class implementing
ICities.IUserMod as usual. Add as many classes in as many source files as you like. They will all be compiled to a single DLL.
F6 to compile your mod. The Output Type in your project’s Properties should be set to Class Library. The compiled DLL will be placed in
obj\Release under the project folder, depending on the active configuration. You can switch configurations with the combo box in the toolbar.
Create a directory for your mod in
%LOCALAPPDATA%\Colossal Order\Cities_Skylines\Addons\Mods\ and copy the compiled DLL to it. It should now be available in the Content Manager of Cities: Skylines.
To automatically copy the DLL to the mod directory after each build, follow these steps:
Right-click your project in the Solution Explorer and choose Properties
Select Build Events on the left hand side of the property sheet
Paste the following in the Post-build event command line:
mkdir "%LOCALAPPDATA%\Colossal Order\Cities_Skylines\Addons\Mods\$(SolutionName)" del "%LOCALAPPDATA%\Colossal Order\Cities_Skylines\Addons\Mods\$(SolutionName)\$(TargetFileName)" xcopy /y "$(TargetPath)" "%LOCALAPPDATA%\Colossal Order\Cities_Skylines\Addons\Mods\$(SolutionName)"
This assumes that your mod directory has the same name as your solution. If it doesn’t you can change
$(SolutionName)to the directory of your mod.
Optionally, you can automate the launching of the game (to save those precious seconds of clicking in steam):
"%STEAMDIRECTORY%\Steam.exe" -applaunch 255710
To make the game reload your mod while running, change the last two lines in AssemblyInfo.cs (under Properties in the Solution Explorer) to read:
[assembly: AssemblyVersion("1.0.*")] //[assembly: AssemblyFileVersion("220.127.116.11")]
Kudos to reimarvin for this post on reddit.
Kudos to walrus_pug for the auto updating with the