Pathoschild.Stardew.ModBuildConfig 2.0.0

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.0                
NuGet\Install-Package Pathoschild.Stardew.ModBuildConfig -Version 2.0.0                
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.0" />                
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.0                
#r "nuget: Pathoschild.Stardew.ModBuildConfig, 2.0.0"                
#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.0

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

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 (10)

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 (6)

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.
Pathoschild/StardewXnbHack
A simple one-way XNB unpacker for Stardew Valley.
CJBok/SDV-Mods
spacechase0/StardewValleyMods
New home for my stardew valley mod source code
Version Downloads Last updated
4.3.1 0 11/5/2024
4.3.0 625 10/7/2024
4.2.0 729 9/5/2024
4.1.1 13,129 6/24/2023
4.1.0 4,767 1/9/2023
4.0.2 2,870 10/9/2022
4.0.1 5,768 4/14/2022
4.0.0 5,324 11/30/2021
4.0.0-beta.20210916 715 9/17/2021
3.4.0-beta.20210813 429 8/13/2021
3.3.0 4,783 3/31/2021
3.2.2 5,852 9/24/2020
3.2.1 1,940 9/11/2020
3.2.0 2,021 9/7/2020
3.1.0 4,801 2/1/2020
3.0.0 4,198 11/26/2019
3.0.0-beta.8 646 7/17/2019
3.0.0-beta.7 1,482 7/9/2019
3.0.0-beta.6 1,329 7/9/2019
3.0.0-beta.5 424 6/28/2019
3.0.0-beta.4 350 6/19/2019
3.0.0-beta.3 459 6/17/2019
3.0.0-beta.2 337 6/13/2019
3.0.0-beta 1,588 6/13/2019
3.0.0-alpha.20190419 418 4/19/2019
2.2.0 9,350 10/28/2018
2.2.0-beta-20180819 2,576 8/20/2018
2.1.0 5,047 7/27/2018
2.1.0-beta-20180630 3,464 6/30/2018
2.1.0-beta-20180629 2,337 6/30/2018
2.1.0-beta-20180625 2,272 6/25/2018
2.1.0-beta-20180428 3,711 4/29/2018
2.1.0-beta-20180426 2,295 4/27/2018
2.1.0-beta 2,541 4/26/2018
2.1.0-alpha20180410 2,280 4/10/2018
2.0.3-alpha20180325 2,337 3/25/2018
2.0.3-alpha20180307 2,205 3/7/2018
2.0.2 4,550 11/1/2017
2.0.1 2,815 10/11/2017
2.0.0 2,443 10/11/2017
1.7.1 3,102 7/28/2017
1.7.0 3,031 7/28/2017
1.6.2 2,743 7/10/2017
1.6.1 2,875 7/10/2017
1.6.0 2,705 6/5/2017
1.5.0 3,795 1/23/2017
1.4.0 2,549 1/11/2017
1.3.0 3,198 12/31/2016
1.2.0 2,937 10/24/2016
1.1.0 2,918 10/21/2016
1.0.1 3,231 10/21/2016

- 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.