Pathoschild.Stardew.ModBuildConfig 2.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Pathoschild.Stardew.ModBuildConfig --version 2.0.1
NuGet\Install-Package Pathoschild.Stardew.ModBuildConfig -Version 2.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="2.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Pathoschild.Stardew.ModBuildConfig --version 2.0.1
#r "nuget: Pathoschild.Stardew.ModBuildConfig, 2.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Pathoschild.Stardew.ModBuildConfig as a Cake Addin
#addin nuget:?package=Pathoschild.Stardew.ModBuildConfig&version=2.0.1

// Install Pathoschild.Stardew.ModBuildConfig as a Cake Tool
#tool nuget:?package=Pathoschild.Stardew.ModBuildConfig&version=2.0.1

The mod build package is an open-source NuGet package which automates the MSBuild configuration for SMAPI mods.

The package...

  • lets your code compile on any computer (Linux/Mac/Windows) without needing to change the assembly references or game path.
  • packages the mod into the game's Mods folder when you rebuild the code (configurable).
  • configures Visual Studio so you can debug into the mod code when the game is running (Windows only).

Install

When creating a new mod:

  1. Create an empty library project.
  2. Reference the Pathoschild.Stardew.ModBuildConfig NuGet package.
  3. Write your code.
  4. Compile on any platform.

When migrating an existing mod:

  1. Remove any project references to Microsoft.Xna.*, MonoGame, Stardew Valley, StardewModdingAPI, and xTile.
  2. Reference the Pathoschild.Stardew.ModBuildConfig NuGet package.
  3. Compile on any platform.

Configure

Deploy files into the Mods folder

By default, your mod will be copied into the game's Mods folder (with a subfolder matching your project name) when you rebuild the code. The package will automatically include your manifest.json, any i18n files, and the build output.

To add custom files to the mod folder, just add them to the build output. (If your project references another mod, make sure the reference is not marked 'copy local'.)

You can change the mod's folder name by adding this above the first </PropertyGroup> in your .csproj:

<ModFolderName>YourModName</ModFolderName>

If you don't want to deploy the mod automatically, you can add this:

<EnableModDeploy>False</EnableModDeploy>
Create release zip

By default, a zip file will be created in the build output when you rebuild the code. This zip file contains all the files needed to share your mod in the recommended format for uploading to Nexus Mods or other sites.

You can change the zipped folder name (and zip name) by adding this above the first </PropertyGroup> in your .csproj:

<ModFolderName>YourModName</ModFolderName>

You can change the folder path where the zip is created like this:

<ModZipPath>$(SolutionDir)\_releases</ModZipPath>

Finally, you can disable the zip creation with this:

<EnableModZip>False</EnableModZip>

Or only create it in release builds with this:

<EnableModZip Condition="$(Configuration) != 'Release'">False</EnableModZip>
Game path

The package usually detects where your game is installed automatically. If it can't find your game or you have multiple installs, you can specify the path yourself. There's two ways to do that:

  • Option 1: global game path (recommended).
    This will apply to every project that uses the package.

    1. Get the full folder path containing the Stardew Valley executable.

    2. Create this file:

      • Linux/Mac: ~/stardewvalley.targets
      • Windows: %USERPROFILE%\stardewvalley.targets
    3. Save the file with this content:

      <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
         <PropertyGroup>
           <GamePath>PATH_HERE</GamePath>
         </PropertyGroup>
      </Project>
      
    4. Replace PATH_HERE with your game path.

  • Option 2: path in the project file.
    You'll need to do this for each project that uses the package.

    1. Get the folder path containing the Stardew Valley .exe file.

    2. Add this to your .csproj file under the <Project line:

      <PropertyGroup>
        <GamePath>PATH_HERE</GamePath>
      </PropertyGroup>
      
    3. Replace PATH_HERE with your custom game install path.

The configuration will check your custom path first, then fall back to the default paths (so it'll still compile on a different computer).

Troubleshoot

"Failed to find the game install path"

That error means the package couldn't find your game. You can specify the game path yourself; see Game path above.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages (9)

Showing the top 5 NuGet packages that depend on Pathoschild.Stardew.ModBuildConfig:

Package Downloads
Platonymous.PyTK

Modding Toolkit for Stardew Valley

MaxVollmer.StardewValley.DeepWoodsMod.API

API for the DeepWoodsMod for Stardew Valley.

Juice805.StardewConfigFramework

A Unified Mod Options Page For Modders and Users. Keep all your mod settings in one place!

Bookcase

Additional utilities for making stardew mods and ensuring cross compatability.

EventGenerator

A handy Event Generator API for Stardew Valley's "SMAPI by PathosChild"

GitHub repositories (5)

Showing the top 5 popular GitHub repositories that depend on Pathoschild.Stardew.ModBuildConfig:

Repository Stars
Pathoschild/StardewMods
Mods for Stardew Valley using SMAPI.
FlashShifter/StardewValleyExpanded
The Stardew Valley Expanded mod for Stardew Valley.
daleao/modular-overhaul
CJBok/SDV-Mods
Pathoschild/StardewXnbHack
A simple one-way XNB unpacker for Stardew Valley.
Version Downloads Last updated
4.1.1 8,752 6/24/2023
4.1.0 4,498 1/9/2023
4.0.2 2,762 10/9/2022
4.0.1 5,585 4/14/2022
4.0.0 5,084 11/30/2021
4.0.0-beta.20210916 656 9/17/2021
3.4.0-beta.20210813 415 8/13/2021
3.3.0 4,684 3/31/2021
3.2.2 5,728 9/24/2020
3.2.1 1,910 9/11/2020
3.2.0 1,991 9/7/2020
3.1.0 4,703 2/1/2020
3.0.0 4,129 11/26/2019
3.0.0-beta.8 622 7/17/2019
3.0.0-beta.7 1,462 7/9/2019
3.0.0-beta.6 1,315 7/9/2019
3.0.0-beta.5 413 6/28/2019
3.0.0-beta.4 331 6/19/2019
3.0.0-beta.3 444 6/17/2019
3.0.0-beta.2 324 6/13/2019
3.0.0-beta 1,558 6/13/2019
3.0.0-alpha.20190419 409 4/19/2019
2.2.0 9,040 10/28/2018
2.2.0-beta-20180819 2,500 8/20/2018
2.1.0 4,944 7/27/2018
2.1.0-beta-20180630 3,367 6/30/2018
2.1.0-beta-20180629 2,308 6/30/2018
2.1.0-beta-20180625 2,246 6/25/2018
2.1.0-beta-20180428 3,659 4/29/2018
2.1.0-beta-20180426 2,254 4/27/2018
2.1.0-beta 2,511 4/26/2018
2.1.0-alpha20180410 2,251 4/10/2018
2.0.3-alpha20180325 2,290 3/25/2018
2.0.3-alpha20180307 2,177 3/7/2018
2.0.2 4,514 11/1/2017
2.0.1 2,780 10/11/2017
2.0.0 2,416 10/11/2017
1.7.1 3,061 7/28/2017
1.7.0 2,998 7/28/2017
1.6.2 2,700 7/10/2017
1.6.1 2,842 7/10/2017
1.6.0 2,674 6/5/2017
1.5.0 3,749 1/23/2017
1.4.0 2,522 1/11/2017
1.3.0 3,160 12/31/2016
1.2.0 2,899 10/24/2016
1.1.0 2,892 10/21/2016
1.0.1 3,200 10/21/2016

2.0:
- Added: mods are now copied into the `Mods` folder automatically (configurable).
- Added: release zips are now created automatically in your build output folder (configurable).
- Added: mod deploy and release zips now exclude Json.NET automatically, since it's provided by SMAPI.
- Added mod's version to release zip filename.
- Improved errors to simplify troubleshooting.
- Fixed release zip not having a mod folder.
- Fixed release zip failing if mod name contains characters that aren't valid in a filename.

2.0.1:
- Fixed mod deploy failing to create subfolders if they don't already exist.