Pathoschild.Stardew.ModBuildConfig 2.0.3-alpha20180325

This is a prerelease version of Pathoschild.Stardew.ModBuildConfig.
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.3-alpha20180325                
NuGet\Install-Package Pathoschild.Stardew.ModBuildConfig -Version 2.0.3-alpha20180325                
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.3-alpha20180325" />                
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.3-alpha20180325                
#r "nuget: Pathoschild.Stardew.ModBuildConfig, 2.0.3-alpha20180325"                
#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.3-alpha20180325&prerelease

// Install Pathoschild.Stardew.ModBuildConfig as a Cake Tool
#tool nuget:?package=Pathoschild.Stardew.ModBuildConfig&version=2.0.3-alpha20180325&prerelease                

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

Contents

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:

      platform path
      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).

Unit test projects

(upcoming in 2.0.3)

You can use the package in unit test projects too. Its optional unit test mode...

  1. disables deploying the project as a mod;
  2. disables creating a release zip;
  3. and copies the referenced DLLs into the build output for unit test frameworks.

To enable it, add this above the first </PropertyGroup> in your .csproj:

<ModUnitTests>True</ModUnitTests>

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.

Release notes

2.0.3 alpha

  • Added support for Stardew Valley 1.3.
  • Added support for unit test projects.

2.0.2

  • Fixed compatibility issue on Linux.

2.0.1

  • Fixed mod deploy failing to create subfolders if they don't already exist.

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.

1.7.1

  • Fixed issue where i18n folders were flattened.
  • The manifest/i18n files in the project now take precedence over those in the build output if both are present.

1.7

  • Added option to create release zips on build.
  • Added reference to XNA's XACT library for audio-related mods.

1.6

  • Added support for deploying mod files into Mods automatically.
  • Added a build error if a game folder is found, but doesn't contain Stardew Valley or SMAPI.

1.5

  • Added support for setting a custom game path globally.
  • Added default GOG path on Mac.

1.4

  • Fixed detection of non-default game paths on 32-bit Windows.
  • Removed support for SilVerPLuM (discontinued).
  • Removed support for overriding the target platform (no longer needed since SMAPI crossplatforms mods automatically).

1.3

  • Added support for non-default game paths on Windows.

1.2

  • Exclude game binaries from mod build output.

1.1

  • Added support for overriding the target platform.

1.0

  • Initial release.
  • Added support for detecting the game path automatically.
  • Added support for injecting XNA/MonoGame references automatically based on the OS.
  • Added support for mod builders like SilVerPLuM.
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.
spacechase0/StardewValleyMods
New home for my stardew valley mod source code
CJBok/SDV-Mods
Version Downloads Last updated
4.3.2 611 11/9/2024
4.3.1 373 11/5/2024
4.3.0 682 10/7/2024
4.2.0 792 9/5/2024
4.1.1 13,397 6/24/2023
4.1.0 4,819 1/9/2023
4.0.2 2,883 10/9/2022
4.0.1 5,803 4/14/2022
4.0.0 5,368 11/30/2021
4.0.0-beta.20210916 734 9/17/2021
3.4.0-beta.20210813 432 8/13/2021
3.3.0 4,801 3/31/2021
3.2.2 5,882 9/24/2020
3.2.1 1,942 9/11/2020
3.2.0 2,024 9/7/2020
3.1.0 4,828 2/1/2020
3.0.0 4,217 11/26/2019
3.0.0-beta.8 649 7/17/2019
3.0.0-beta.7 1,485 7/9/2019
3.0.0-beta.6 1,331 7/9/2019
3.0.0-beta.5 428 6/28/2019
3.0.0-beta.4 355 6/19/2019
3.0.0-beta.3 461 6/17/2019
3.0.0-beta.2 341 6/13/2019
3.0.0-beta 1,590 6/13/2019
3.0.0-alpha.20190419 420 4/19/2019
2.2.0 9,374 10/28/2018
2.2.0-beta-20180819 2,581 8/20/2018
2.1.0 5,060 7/27/2018
2.1.0-beta-20180630 3,470 6/30/2018
2.1.0-beta-20180629 2,343 6/30/2018
2.1.0-beta-20180625 2,276 6/25/2018
2.1.0-beta-20180428 3,718 4/29/2018
2.1.0-beta-20180426 2,300 4/27/2018
2.1.0-beta 2,548 4/26/2018
2.1.0-alpha20180410 2,287 4/10/2018
2.0.3-alpha20180325 2,342 3/25/2018
2.0.3-alpha20180307 2,209 3/7/2018
2.0.2 4,560 11/1/2017
2.0.1 2,821 10/11/2017
2.0.0 2,447 10/11/2017
1.7.1 3,107 7/28/2017
1.7.0 3,036 7/28/2017
1.6.2 2,749 7/10/2017
1.6.1 2,879 7/10/2017
1.6.0 2,709 6/5/2017
1.5.0 3,806 1/23/2017
1.4.0 2,553 1/11/2017
1.3.0 3,202 12/31/2016
1.2.0 2,942 10/24/2016
1.1.0 2,924 10/21/2016
1.0.1 3,235 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.

     2.0.2:
     - Fixed compatibility issue on Linux.

     2.0.3:
     - Added support for Stardew Valley 1.3.
     - Added support for unit test projects.