To be able to view the source code code of Cities: Skylines 2, we need a few tools.
Visual Studio
Visual Studio Community edition is a free IDE to write .NET code in C# and other languages.
- Install Visual Studio Community Edition from the Microsoft site atVisual Studio Community Edition
Decompiler
To decompile the game code to the source code, we will use the ILSpy Visual Studio extension.
- Search for the link to the latest version on the ILSpy GitHub page at ILSpy
- At the time of writing, ILSpy 2022 is the latest version, download it from ILSpy 2022
- Double-click the downloaded .vsix file
- Restart Visual Studio if it was running at the time of the extension installation
Decompiling Cities: Skylines II
- Start Visual Studio
- Select Continue without code to start a new project
- In the Tools menu select ILSpy
- In the ILSpy window select File, Open
- Select Game.dll in the “C:\Program Files (x86)\Steam\steamapps\common\Cities Skylines II\Cities2_Data\Managed” directory
- On the left side expand the Game node
Save the game code
To save the game code as a Visual Studio project
- Right-click the Game node and select Save Code…
Examining the original game code
- In the Visual Studio File menu select Open, Project/Solution
- Open the Game.csproj C# project
- To search for words in the game source code press CTRL-F or open the Quick Find dialog box