Getting Started with Eco Modding in Visual Studio

From Eco - English Wiki

Introduction

This guide covers how you could use Visual Studio 2022 as the development environment for your Eco mods. Writing mods for Eco requires you to understand general programing concepts and the C# programming language. This guide won't teach you how to code or how Eco mods work. Instead, it walks you through setting up and using Visual Studio 2022 as a development environment — from creating your project to building and testing your mod.

Have Ready

  • A copy of the Eco game installed (ideally the server installation) See: Setting Up a Server
  • A file explorer and the file path of the "Eco Server" folder (for Steam users that's something like C:\Program Files (x86)\Steam\steamapps\common\Eco Server\)

Installing Visual Studio 2022

Visual Studio 2022 (VS2022) has a completely free to use version called the Community Edition. This guide is written assuming that's the version used.

To install VS2022 go to download page

Look for the "Visual Studio Community 2022" to download. At the time of writing this is what the download button looks like:

A picture of a website showing a row. The first column has the name "Visual Studio Community 2022" and there's a "Download" button two columns to the right, past it's description text.

Download it. Then, run the installer till this the installer gets a "Workloads" page. On this page, select these workloads:

  • .NET desktop development option -- Required for any mod development
  • ASP.NET and web development -- Optional. If you want to interact with external websites or Eco's own web server (e.g. Discord's web-hooks or extending the API)

At the time of writing, this is what the Workloads page looks like with those options selected:Workloads screen during VS2022 installation. Options selected are "ASP.NET and web development" and ".NET desktop development".

Click "Install" and let it complete your installation. By default, it should launch the application after it installs.

It will ask you to sign in. You do not need to and can completely avoid this by clicking the "Skip and add accounts later." option in tiny text below the buttons. However, if you plan to upload your mod to Github VS2022 does have integrated support for that. So consider signing in with GitHub to make that process easier.

This guide is continuing as if the "Skip and add accounts later." option was selected. Finally, it might ask what color theme you'd like. Select your preference and continue. That completes the installation!

Creating a New Mod Project

When VS2022 first opens it will show you a dashboard where you can quickly select what you want to do. On the left, are any recent projects opened. There won't be any if this is the first time installing it. On the right there will be a few options, from here select the "Create a new project" option.

VS2022's launch dashboard showing recent projects on the left and quick action buttons on the right. Highlighted is a button titled "Create a new project".

Now, it's time to go through the new project wizard. First, the wizard asks what kind of project is being made. To mod Eco we need to make a C# class library.

To find the template, search "C# library" in the search bar. Select the C# option titled "Class Library". It's important to pay attention to the icon and chips below the title and description. Make sure you select the "C#" option.

location=center

Linking to Eco Assemblies

Structuring The Mod

Setting up Debugging

Building The Mod

Managing Dependencies

Tips and Tricks

TODO: How to print debug.

Where to Next?