diff options
-rw-r--r-- | README.md | 39 | ||||
-rw-r--r-- | build/smapi.targets | 82 | ||||
-rw-r--r-- | package.nuspec | 2 |
3 files changed, 71 insertions, 52 deletions
@@ -1,29 +1,38 @@ **Stardew.ModBuildConfig** is an open-source NuGet package which automates the build configuration for crossplatform [Stardew Valley](http://stardewvalley.net/) mods that use SMAPI. -The configuration detects the operating system (Linux, Mac, or Windows) and the Stardew Valley -install path, and injects the correct references to Stardew Valley, SMAPI, and XNA/MonoGame. -It also adds a `GamePath` variable which can be used to automate mod installation during testing -if desired. +The configuration... -## Contents -* [Installation](#installation) -* [Configuration](#configuration) -* [Versions](#versions) -* [See also](#see-also) +1. detects the operating system (Linux, Mac, or Windows) and the Stardew Valley install path; +2. injects the correct references to Stardew Valley, SMAPI, and XNA/MonoGame; +3. (on Windows) configures Visual Studio so you can launch the game for debugging; +4. and adds a `GamePath` variable which can be used to automate mod installation during testing + if desired. ## Installation -### New mod -_TODO_ +### Creating a new mod +1. Create an empty library project. +2. Reference the `Pathoschild.Stardew.ModBuildConfig` NuGet package. +3. [Write your code](http://canimod.com/guides/creating-a-smapi-mod). +4. Compile on any platform. ### Migrating an existing mod -_TODO_ +1. Remove any references to `Microsoft.Xna.*`, Stardew Valley, `StardewModdingAPI`, and xTile. +2. Reference the `Pathoschild.Stardew.ModBuildConfig` NuGet package. +3. Compile on any platform. ## Configuration -_TODO_ +### Custom game path +If you customised where Stardew Valley is installed, you can add your path to the list to try. -## Versions -_TODO_ +1. Get the full path to the directory containing the Stardew Valley executable. +2. Add this section to your `.csproj` file (anywhere before the added `<Import` line): + + ``` + <PropertyGroup> + <GamePath>C:\Program Files (x86)\GalaxyClient\Games\Stardew Valley</GamePath> + </PropertyGroup> + ``` ## See also _TODO_ diff --git a/build/smapi.targets b/build/smapi.targets index 1e71d06a..6231650c 100644 --- a/build/smapi.targets +++ b/build/smapi.targets @@ -1,47 +1,57 @@ <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <!-- mod build info --> + <!-- find game install path --> <PropertyGroup> <GamePath>C:\Program Files (x86)\GalaxyClient\Games\Stardew Valley</GamePath> <GamePath Condition="!Exists('$(GamePath)')">C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley</GamePath> <GamePath Condition="!Exists('$(GamePath)')">~\Library\Application Support\Steam\steamapps\common\Stardew Valley\Contents\MacOS</GamePath> - <StartAction>Program</StartAction> - <StartProgram>$(GamePath)\StardewModdingAPI.exe</StartProgram> - <StartWorkingDirectory>$(GamePath)</StartWorkingDirectory> </PropertyGroup> - <!-- references for Windows --> - <ItemGroup Condition="$(OS) == 'Windows_NT'"> - <Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" /> - <Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" /> - <Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" /> - <Reference Include="Stardew Valley"> - <HintPath>$(GamePath)\Stardew Valley.exe</HintPath> - </Reference> - <Reference Include="StardewModdingAPI"> - <HintPath>$(GamePath)\StardewModdingAPI.exe</HintPath> - </Reference> - <Reference Include="xTile, Version=2.0.4.0, Culture=neutral, processorArchitecture=x86"> - <SpecificVersion>False</SpecificVersion> - <HintPath>$(GamePath)\xTile.dll</HintPath> - </Reference> - </ItemGroup> + <!-- set up configuration --> + <Choose> + <When Condition="$(OS) == 'Windows_NT'"> + <!-- references --> + <ItemGroup> + <Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" /> + <Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" /> + <Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" /> + <Reference Include="Stardew Valley"> + <HintPath>$(GamePath)\Stardew Valley.exe</HintPath> + </Reference> + <Reference Include="StardewModdingAPI"> + <HintPath>$(GamePath)\StardewModdingAPI.exe</HintPath> + </Reference> + <Reference Include="xTile, Version=2.0.4.0, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>$(GamePath)\xTile.dll</HintPath> + </Reference> + </ItemGroup> - <!-- references for Linux/Mac --> - <ItemGroup Condition="$(OS) == 'Unix'"> - <Reference Include="MonoGame.Framework"> - <SpecificVersion>False</SpecificVersion> - <HintPath>$(GamePath)\MonoGame.Framework.dll</HintPath> - </Reference> - <Reference Include="StardewValley"> - <HintPath>$(GamePath)\StardewValley.exe</HintPath> - </Reference> - <Reference Include="StardewModdingAPI"> - <HintPath>$(GamePath)\StardewModdingAPI.exe</HintPath> - </Reference> - <Reference Include="xTile"> - <HintPath>$(GamePath)\xTile.dll</HintPath> - </Reference> - </ItemGroup> + <!-- launch game for debugging --> + <PropertyGroup> + <StartAction>Program</StartAction> + <StartProgram>$(GamePath)\StardewModdingAPI.exe</StartProgram> + <StartWorkingDirectory>$(GamePath)</StartWorkingDirectory> + </PropertyGroup> + </When> + <Otherwise> + <!-- references --> + <ItemGroup> + <Reference Include="MonoGame.Framework"> + <SpecificVersion>False</SpecificVersion> + <HintPath>$(GamePath)\MonoGame.Framework.dll</HintPath> + </Reference> + <Reference Include="StardewValley"> + <HintPath>$(GamePath)\StardewValley.exe</HintPath> + </Reference> + <Reference Include="StardewModdingAPI"> + <HintPath>$(GamePath)\StardewModdingAPI.exe</HintPath> + </Reference> + <Reference Include="xTile"> + <HintPath>$(GamePath)\xTile.dll</HintPath> + </Reference> + </ItemGroup> + </Otherwise> + </Choose> <!-- Validate game path & automate mod package --> <Target Name="BeforeBuild"> diff --git a/package.nuspec b/package.nuspec index 5d8e5e52..a000d986 100644 --- a/package.nuspec +++ b/package.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd"> <metadata> <id>Pathoschild.Stardew.ModdingBuildConfig</id> - <version>1.0-alpha</version> + <version>1.0-alpha2</version> <title>MSBuild config for Stardew Valley mods</title> <authors>Pathoschild</authors> <owners>Pathoschild</owners> |