From 6fdb29d806eddd17f0ac33401781f7df58639075 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 10 Jan 2019 19:30:11 -0500 Subject: drop support for old versions of SMAPI and Visual Studio in mod build package --- src/SMAPI.ModBuildConfig/build/smapi.targets | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/SMAPI.ModBuildConfig/build/smapi.targets') diff --git a/src/SMAPI.ModBuildConfig/build/smapi.targets b/src/SMAPI.ModBuildConfig/build/smapi.targets index e6c3fa57..99011629 100644 --- a/src/SMAPI.ModBuildConfig/build/smapi.targets +++ b/src/SMAPI.ModBuildConfig/build/smapi.targets @@ -102,7 +102,6 @@ $(GamePath)\smapi-internal\StardewModdingAPI.Toolkit.CoreInterfaces.dll - $(GamePath)\StardewModdingAPI.Toolkit.CoreInterfaces.dll false true @@ -142,7 +141,6 @@ $(GamePath)\smapi-internal\StardewModdingAPI.Toolkit.CoreInterfaces.dll - $(GamePath)\StardewModdingAPI.Toolkit.CoreInterfaces.dll false true -- cgit From ee132828437c156207ddfc1cbc15339a6852c2fe Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 15 Apr 2019 22:13:10 -0400 Subject: update for new DLL in SDV 1.4 (#638) --- docs/mod-build-config.md | 1 + src/SMAPI.ModBuildConfig/build/smapi.targets | 10 ++++++++++ src/SMAPI.ModBuildConfig/package.nuspec | 1 + 3 files changed, 12 insertions(+) (limited to 'src/SMAPI.ModBuildConfig/build/smapi.targets') diff --git a/docs/mod-build-config.md b/docs/mod-build-config.md index 5024aec5..8bd7b79d 100644 --- a/docs/mod-build-config.md +++ b/docs/mod-build-config.md @@ -214,6 +214,7 @@ _[Game path](#game-path)_ above. ## Release notes ### Upcoming release +* Updated for Stardew Valley 1.4. * If the project contains an `assets` folder, its contents are now included in the mod automatically. * Dropped support for very old versions of SMAPI and Visual Studio. * Fixed `Newtonsoft.Json.pdb` included in release zips when Json.NET is referenced directly. diff --git a/src/SMAPI.ModBuildConfig/build/smapi.targets b/src/SMAPI.ModBuildConfig/build/smapi.targets index 99011629..e3211466 100644 --- a/src/SMAPI.ModBuildConfig/build/smapi.targets +++ b/src/SMAPI.ModBuildConfig/build/smapi.targets @@ -95,6 +95,11 @@ false true + + $(GamePath)\StardewValley.GameData.dll + false + true + $(GamePath)\StardewModdingAPI.exe false @@ -134,6 +139,11 @@ false true + + $(GamePath)\StardewValley.GameData.dll + false + true + $(GamePath)\StardewModdingAPI.exe false diff --git a/src/SMAPI.ModBuildConfig/package.nuspec b/src/SMAPI.ModBuildConfig/package.nuspec index eb967bc0..b6ef98f0 100644 --- a/src/SMAPI.ModBuildConfig/package.nuspec +++ b/src/SMAPI.ModBuildConfig/package.nuspec @@ -13,6 +13,7 @@ Automates the build configuration for crossplatform Stardew Valley SMAPI mods. For SMAPI 2.11 or later. 3.0.0: + - Updated for Stardew Valley 1.4. - If the project contains an `assets` folder, its contents are now included in the mod automatically. - Dropped support for very old versions of SMAPI and Visual Studio. - Fixed `Newtonsoft.Json.pdb` included in release zips when Json.NET is referenced directly. -- cgit From aa7e4b9c36bf14656493ee0a7ab2dab394a3cf64 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 18 Apr 2019 22:42:04 -0400 Subject: add new DLL to SMAPI references, support older game versions in package, fix name on Linux/Mac (#638) --- build/common.targets | 10 +++++++++- src/SMAPI.ModBuildConfig/build/smapi.targets | 10 +++++----- 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'src/SMAPI.ModBuildConfig/build/smapi.targets') diff --git a/build/common.targets b/build/common.targets index 0781d568..4aac55fc 100644 --- a/build/common.targets +++ b/build/common.targets @@ -45,10 +45,14 @@ - + $(GamePath)\Stardew Valley.exe False + + $(GamePath)\StardewValley.GameData.dll + False + $(GamePath)\Netcode.dll False @@ -73,6 +77,10 @@ $(GamePath)\StardewValley.exe False + + $(GamePath)\StardewValley.GameData.MonoGame.dll + False + $(GamePath)\MonoGame.Framework.dll False diff --git a/src/SMAPI.ModBuildConfig/build/smapi.targets b/src/SMAPI.ModBuildConfig/build/smapi.targets index e3211466..f703477f 100644 --- a/src/SMAPI.ModBuildConfig/build/smapi.targets +++ b/src/SMAPI.ModBuildConfig/build/smapi.targets @@ -95,7 +95,7 @@ false true - + $(GamePath)\StardewValley.GameData.dll false true @@ -113,7 +113,7 @@ $(GamePath)\xTile.dll false - False + false true @@ -131,7 +131,7 @@ $(GamePath)\MonoGame.Framework.dll false - False + false true @@ -139,8 +139,8 @@ false true - - $(GamePath)\StardewValley.GameData.dll + + $(GamePath)\StardewValley.GameData.MonoGame.dll false true -- cgit From e18ffc009d4fd56b200b0bb13b671940c9fadbc7 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 25 Apr 2019 00:50:26 -0400 Subject: update mods + mod build package for smapi-internal changes --- build/prepare-nuget-package.targets | 8 ++++---- docs/mod-build-config.md | 4 ++-- src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj | 1 + src/SMAPI.ModBuildConfig/build/smapi.targets | 14 +++++++------- src/SMAPI.ModBuildConfig/package.nuspec | 6 +++--- src/SMAPI/Constants.cs | 12 ++++++++---- 6 files changed, 25 insertions(+), 20 deletions(-) (limited to 'src/SMAPI.ModBuildConfig/build/smapi.targets') diff --git a/build/prepare-nuget-package.targets b/build/prepare-nuget-package.targets index 8894c273..cafaeda6 100644 --- a/build/prepare-nuget-package.targets +++ b/build/prepare-nuget-package.targets @@ -13,9 +13,9 @@ - - - - + + + + diff --git a/docs/mod-build-config.md b/docs/mod-build-config.md index fc63a5a2..aee81113 100644 --- a/docs/mod-build-config.md +++ b/docs/mod-build-config.md @@ -228,11 +228,11 @@ _[Game path](#game-path)_ above. ## Release notes ### Upcoming release -* Updated for Stardew Valley 1.4. +* Updated for SMAPI 3.0 and Stardew Valley 1.4. * If the project contains an `assets` folder, its contents are now included in the mod automatically. * Fixed `Newtonsoft.Json.pdb` included in release zips when Json.NET is referenced directly. * Fixed `` not working for `i18n` files. -* Dropped support for very old versions of SMAPI and Visual Studio. +* Dropped support for older versions of SMAPI and Visual Studio. ### 2.2 * Added support for SMAPI 2.8+ (still compatible with earlier versions). diff --git a/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj b/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj index f39a1555..0af8eef9 100644 --- a/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj +++ b/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj @@ -36,5 +36,6 @@ + diff --git a/src/SMAPI.ModBuildConfig/build/smapi.targets b/src/SMAPI.ModBuildConfig/build/smapi.targets index f703477f..c8f60c65 100644 --- a/src/SMAPI.ModBuildConfig/build/smapi.targets +++ b/src/SMAPI.ModBuildConfig/build/smapi.targets @@ -2,7 +2,7 @@ - + + - - $(DeployModFolderName) - $(DeployModZipTo) - - + $(MSBuildProjectName) $(TargetDir) True -- cgit From d5a7465b0219c3d736b1ac5aff1758ba41887fcc Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Tue, 11 Jun 2019 20:23:20 -0400 Subject: add mod build features for new csproj format --- docs/mod-build-config.md | 5 ++++- src/SMAPI.ModBuildConfig/build/smapi.targets | 7 +++++++ src/SMAPI.ModBuildConfig/package.nuspec | 5 ++++- 3 files changed, 15 insertions(+), 2 deletions(-) (limited to 'src/SMAPI.ModBuildConfig/build/smapi.targets') diff --git a/docs/mod-build-config.md b/docs/mod-build-config.md index aee81113..22b5f4ea 100644 --- a/docs/mod-build-config.md +++ b/docs/mod-build-config.md @@ -230,8 +230,11 @@ _[Game path](#game-path)_ above. ### Upcoming release * Updated for SMAPI 3.0 and Stardew Valley 1.4. * If the project contains an `assets` folder, its contents are now included in the mod automatically. +* For projects using the new `.csproj` format: + * platform target is now set to x86 automatically to avoid mismatching platform target warnings; + * added GAC to assembly search paths to fix references to XNA Framework. * Fixed `Newtonsoft.Json.pdb` included in release zips when Json.NET is referenced directly. -* Fixed `` not working for `i18n` files. +* Fixed `<IgnoreModFilePatterns>` not working for `i18n` files. * Dropped support for older versions of SMAPI and Visual Studio. ### 2.2 diff --git a/src/SMAPI.ModBuildConfig/build/smapi.targets b/src/SMAPI.ModBuildConfig/build/smapi.targets index 79a491e7..e9209a45 100644 --- a/src/SMAPI.ModBuildConfig/build/smapi.targets +++ b/src/SMAPI.ModBuildConfig/build/smapi.targets @@ -13,6 +13,13 @@ + + x86 + x86 + + + $(AssemblySearchPaths);{GAC} + $(MSBuildProjectName) $(TargetDir) diff --git a/src/SMAPI.ModBuildConfig/package.nuspec b/src/SMAPI.ModBuildConfig/package.nuspec index c6ee6503..28bcf807 100644 --- a/src/SMAPI.ModBuildConfig/package.nuspec +++ b/src/SMAPI.ModBuildConfig/package.nuspec @@ -2,7 +2,7 @@ Pathoschild.Stardew.ModBuildConfig - 3.0.0-alpha.20190426 + 3.0.0-alpha.20190611 Build package for SMAPI mods Pathoschild Pathoschild @@ -16,6 +16,9 @@ 3.0.0: - Updated for SMAPI 3.0 and Stardew Valley 1.4. - If the project contains an `assets` folder, its contents are now included in the mod automatically. + - For projects using the new `.csproj` format: + - platform target is now set to x86 automatically to avoid mismatching platform target warnings; + - added GAC to assembly search paths to fix references to XNA Framework. - Fixed `Newtonsoft.Json.pdb` included in release zips when Json.NET is referenced directly. - Fixed `<IgnoreModFilePatterns>` not working for `i18n` files. - Dropped support for older versions of SMAPI and Visual Studio. -- cgit From 93551c094139d4446ef5c4fc69bcda26e49e62bd Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 13 Jun 2019 18:19:27 -0400 Subject: add temporary backwards compatibility for SDV 1.3.36 in mod build package --- docs/mod-build-config.md | 4 ++-- src/SMAPI.ModBuildConfig/build/smapi.targets | 10 ++++++++-- src/SMAPI.ModBuildConfig/package.nuspec | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) (limited to 'src/SMAPI.ModBuildConfig/build/smapi.targets') diff --git a/docs/mod-build-config.md b/docs/mod-build-config.md index 22b5f4ea..4ffc34a9 100644 --- a/docs/mod-build-config.md +++ b/docs/mod-build-config.md @@ -228,13 +228,13 @@ _[Game path](#game-path)_ above. ## Release notes ### Upcoming release -* Updated for SMAPI 3.0 and Stardew Valley 1.4. +* Updated for SMAPI 3.0 and Stardew Valley 1.4. (The beta is backwards-compatible with previous versions.) * If the project contains an `assets` folder, its contents are now included in the mod automatically. * For projects using the new `.csproj` format: * platform target is now set to x86 automatically to avoid mismatching platform target warnings; * added GAC to assembly search paths to fix references to XNA Framework. * Fixed `Newtonsoft.Json.pdb` included in release zips when Json.NET is referenced directly. -* Fixed `<IgnoreModFilePatterns>` not working for `i18n` files. +* Fixed `` not working for `i18n` files. * Dropped support for older versions of SMAPI and Visual Studio. ### 2.2 diff --git a/src/SMAPI.ModBuildConfig/build/smapi.targets b/src/SMAPI.ModBuildConfig/build/smapi.targets index e9209a45..103e996a 100644 --- a/src/SMAPI.ModBuildConfig/build/smapi.targets +++ b/src/SMAPI.ModBuildConfig/build/smapi.targets @@ -98,7 +98,7 @@ false true - + $(GamePath)\StardewValley.GameData.dll false true @@ -112,6 +112,9 @@ $(GamePath)\smapi-internal\SMAPI.Toolkit.CoreInterfaces.dll false true + + + $(GamePath)\smapi-internal\StardewModdingAPI.Toolkit.CoreInterfaces.dll $(GamePath)\xTile.dll @@ -142,7 +145,7 @@ false true - + $(GamePath)\StardewValley.GameData.MonoGame.dll false true @@ -156,6 +159,9 @@ $(GamePath)\smapi-internal\SMAPI.Toolkit.CoreInterfaces.dll false true + + + $(GamePath)\smapi-internal\StardewModdingAPI.Toolkit.CoreInterfaces.dll $(GamePath)\xTile.dll diff --git a/src/SMAPI.ModBuildConfig/package.nuspec b/src/SMAPI.ModBuildConfig/package.nuspec index 28bcf807..e82bded4 100644 --- a/src/SMAPI.ModBuildConfig/package.nuspec +++ b/src/SMAPI.ModBuildConfig/package.nuspec @@ -2,7 +2,7 @@ Pathoschild.Stardew.ModBuildConfig - 3.0.0-alpha.20190611 + 3.0.0-beta.2 Build package for SMAPI mods Pathoschild Pathoschild @@ -14,7 +14,7 @@ Automates the build configuration for crossplatform Stardew Valley SMAPI mods. For SMAPI 2.11 or later. 3.0.0: - - Updated for SMAPI 3.0 and Stardew Valley 1.4. + - Updated for SMAPI 3.0 and Stardew Valley 1.4. (The beta is backwards-compatible with previous versions.) - If the project contains an `assets` folder, its contents are now included in the mod automatically. - For projects using the new `.csproj` format: - platform target is now set to x86 automatically to avoid mismatching platform target warnings; -- cgit From 480b307e6220e5a503f02ed857873ec8a0720e91 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 16 Jun 2019 14:18:30 -0400 Subject: include PDB files in mod builds by default --- docs/mod-build-config.md | 4 +++- src/SMAPI.ModBuildConfig/build/smapi.targets | 4 ++++ src/SMAPI.ModBuildConfig/package.nuspec | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src/SMAPI.ModBuildConfig/build/smapi.targets') diff --git a/docs/mod-build-config.md b/docs/mod-build-config.md index 4ffc34a9..22180059 100644 --- a/docs/mod-build-config.md +++ b/docs/mod-build-config.md @@ -8,7 +8,8 @@ The package... * packages the mod into your `Mods` folder when you rebuild the code (configurable); * creates a release zip (configurable); * configures Visual Studio to enable debugging into the code when the game is running (_Windows only_); -* adds C# analyzers to warn for Stardew Valley-specific issues. +* adds C# analyzers to warn for Stardew Valley-specific issues; +* preconfigures common settings (e.g. enable line numbers in stack traces). ## Contents * [Install](#install) @@ -233,6 +234,7 @@ _[Game path](#game-path)_ above. * For projects using the new `.csproj` format: * platform target is now set to x86 automatically to avoid mismatching platform target warnings; * added GAC to assembly search paths to fix references to XNA Framework. +* Builds now include `.pdb` files by default, to enable line numbers in error stack traces. * Fixed `Newtonsoft.Json.pdb` included in release zips when Json.NET is referenced directly. * Fixed `` not working for `i18n` files. * Dropped support for older versions of SMAPI and Visual Studio. diff --git a/src/SMAPI.ModBuildConfig/build/smapi.targets b/src/SMAPI.ModBuildConfig/build/smapi.targets index 103e996a..f797b0d1 100644 --- a/src/SMAPI.ModBuildConfig/build/smapi.targets +++ b/src/SMAPI.ModBuildConfig/build/smapi.targets @@ -17,6 +17,10 @@ x86 x86 + + pdbonly + true + $(AssemblySearchPaths);{GAC} diff --git a/src/SMAPI.ModBuildConfig/package.nuspec b/src/SMAPI.ModBuildConfig/package.nuspec index e82bded4..d7860ee1 100644 --- a/src/SMAPI.ModBuildConfig/package.nuspec +++ b/src/SMAPI.ModBuildConfig/package.nuspec @@ -19,6 +19,7 @@ - For projects using the new `.csproj` format: - platform target is now set to x86 automatically to avoid mismatching platform target warnings; - added GAC to assembly search paths to fix references to XNA Framework. + - Builds now include `.pdb` files by default, to enable line numbers in error stack traces. - Fixed `Newtonsoft.Json.pdb` included in release zips when Json.NET is referenced directly. - Fixed `<IgnoreModFilePatterns>` not working for `i18n` files. - Dropped support for older versions of SMAPI and Visual Studio. -- cgit From 2cf2b6706f9e31775b1afe05980cfaed96ab1690 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 17 Jun 2019 18:52:03 -0400 Subject: move game detection into toolkit for reuse --- docs/mod-build-config.md | 10 ++++++++++ src/SMAPI.ModBuildConfig/build/smapi.targets | 3 ++- src/SMAPI.ModBuildConfig/package.nuspec | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) (limited to 'src/SMAPI.ModBuildConfig/build/smapi.targets') diff --git a/docs/mod-build-config.md b/docs/mod-build-config.md index 22180059..a2b121f4 100644 --- a/docs/mod-build-config.md +++ b/docs/mod-build-config.md @@ -68,6 +68,14 @@ Or only create it in release builds with this: False ``` +### Debug game +The package automatically configures Visual Studio to launch/debug the game when you launch/debug +the project. To disable that, add this above the first `` in your `.csproj`: + +```xml +False +``` + ### 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: @@ -148,6 +156,7 @@ You can use the package in non-mod projects too (e.g. unit tests or framework DL disable deploying the mod and creating a release zip: ```xml +False False False ``` @@ -235,6 +244,7 @@ _[Game path](#game-path)_ above. * platform target is now set to x86 automatically to avoid mismatching platform target warnings; * added GAC to assembly search paths to fix references to XNA Framework. * Builds now include `.pdb` files by default, to enable line numbers in error stack traces. +* You can now optionally disable game debugging config. * Fixed `Newtonsoft.Json.pdb` included in release zips when Json.NET is referenced directly. * Fixed `` not working for `i18n` files. * Dropped support for older versions of SMAPI and Visual Studio. diff --git a/src/SMAPI.ModBuildConfig/build/smapi.targets b/src/SMAPI.ModBuildConfig/build/smapi.targets index f797b0d1..7d29da0b 100644 --- a/src/SMAPI.ModBuildConfig/build/smapi.targets +++ b/src/SMAPI.ModBuildConfig/build/smapi.targets @@ -29,6 +29,7 @@ $(TargetDir) True True + True False @@ -129,7 +130,7 @@ - + Program $(GamePath)\StardewModdingAPI.exe $(GamePath) diff --git a/src/SMAPI.ModBuildConfig/package.nuspec b/src/SMAPI.ModBuildConfig/package.nuspec index d7860ee1..37d7959e 100644 --- a/src/SMAPI.ModBuildConfig/package.nuspec +++ b/src/SMAPI.ModBuildConfig/package.nuspec @@ -20,6 +20,7 @@ - platform target is now set to x86 automatically to avoid mismatching platform target warnings; - added GAC to assembly search paths to fix references to XNA Framework. - Builds now include `.pdb` files by default, to enable line numbers in error stack traces. + - You can now optionally disable game debugging config. - Fixed `Newtonsoft.Json.pdb` included in release zips when Json.NET is referenced directly. - Fixed `<IgnoreModFilePatterns>` not working for `i18n` files. - Dropped support for older versions of SMAPI and Visual Studio. -- cgit From ffe5bc1d4d6ba797a76856b3c98dd853d8f90086 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 17 Jun 2019 18:52:19 -0400 Subject: remove temporary backwards-compat in mod build package --- docs/mod-build-config.md | 2 +- src/SMAPI.ModBuildConfig/build/smapi.targets | 10 ++-------- src/SMAPI.ModBuildConfig/package.nuspec | 4 ++-- 3 files changed, 5 insertions(+), 11 deletions(-) (limited to 'src/SMAPI.ModBuildConfig/build/smapi.targets') diff --git a/docs/mod-build-config.md b/docs/mod-build-config.md index a2b121f4..22c37397 100644 --- a/docs/mod-build-config.md +++ b/docs/mod-build-config.md @@ -238,7 +238,7 @@ _[Game path](#game-path)_ above. ## Release notes ### Upcoming release -* Updated for SMAPI 3.0 and Stardew Valley 1.4. (The beta is backwards-compatible with previous versions.) +* Updated for SMAPI 3.0 and Stardew Valley 1.4. * If the project contains an `assets` folder, its contents are now included in the mod automatically. * For projects using the new `.csproj` format: * platform target is now set to x86 automatically to avoid mismatching platform target warnings; diff --git a/src/SMAPI.ModBuildConfig/build/smapi.targets b/src/SMAPI.ModBuildConfig/build/smapi.targets index 7d29da0b..c24990d5 100644 --- a/src/SMAPI.ModBuildConfig/build/smapi.targets +++ b/src/SMAPI.ModBuildConfig/build/smapi.targets @@ -103,7 +103,7 @@ false true - + $(GamePath)\StardewValley.GameData.dll false true @@ -117,9 +117,6 @@ $(GamePath)\smapi-internal\SMAPI.Toolkit.CoreInterfaces.dll false true - - - $(GamePath)\smapi-internal\StardewModdingAPI.Toolkit.CoreInterfaces.dll $(GamePath)\xTile.dll @@ -150,7 +147,7 @@ false true - + $(GamePath)\StardewValley.GameData.MonoGame.dll false true @@ -164,9 +161,6 @@ $(GamePath)\smapi-internal\SMAPI.Toolkit.CoreInterfaces.dll false true - - - $(GamePath)\smapi-internal\StardewModdingAPI.Toolkit.CoreInterfaces.dll $(GamePath)\xTile.dll diff --git a/src/SMAPI.ModBuildConfig/package.nuspec b/src/SMAPI.ModBuildConfig/package.nuspec index 37d7959e..976b3420 100644 --- a/src/SMAPI.ModBuildConfig/package.nuspec +++ b/src/SMAPI.ModBuildConfig/package.nuspec @@ -2,7 +2,7 @@ Pathoschild.Stardew.ModBuildConfig - 3.0.0-beta.2 + 3.0.0-beta.3 Build package for SMAPI mods Pathoschild Pathoschild @@ -14,7 +14,7 @@ Automates the build configuration for crossplatform Stardew Valley SMAPI mods. For SMAPI 2.11 or later. 3.0.0: - - Updated for SMAPI 3.0 and Stardew Valley 1.4. (The beta is backwards-compatible with previous versions.) + - Updated for SMAPI 3.0 and Stardew Valley 1.4. - If the project contains an `assets` folder, its contents are now included in the mod automatically. - For projects using the new `.csproj` format: - platform target is now set to x86 automatically to avoid mismatching platform target warnings; -- cgit From b3e4162f7cb4d855f7c36def4657209cbd18ba52 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Tue, 18 Jun 2019 23:10:11 -0400 Subject: move logic into separate .targets file file for reuse --- build/common.targets | 28 +------------ build/find-game-folder.targets | 41 ++++++++++++++++++ build/prepare-nuget-package.targets | 1 + .../SMAPI.ModBuildConfig.csproj | 1 + src/SMAPI.ModBuildConfig/build/smapi.targets | 49 ++-------------------- src/SMAPI.sln | 1 + 6 files changed, 50 insertions(+), 71 deletions(-) create mode 100644 build/find-game-folder.targets (limited to 'src/SMAPI.ModBuildConfig/build/smapi.targets') diff --git a/build/common.targets b/build/common.targets index 50ade0f7..6bf1305e 100644 --- a/build/common.targets +++ b/build/common.targets @@ -1,32 +1,8 @@ - - - + - + - - $(HOME)/GOG Games/Stardew Valley/game - $(HOME)/.local/share/Steam/steamapps/common/Stardew Valley - $(HOME)/.steam/steam/steamapps/common/Stardew Valley - - - /Applications/Stardew Valley.app/Contents/MacOS - $(HOME)/Library/Application Support/Steam/steamapps/common/Stardew Valley/Contents/MacOS - - - C:\Program Files\GalaxyClient\Games\Stardew Valley - C:\Program Files\GOG Galaxy\Games\Stardew Valley - C:\Program Files\Steam\steamapps\common\Stardew Valley - - C:\Program Files (x86)\GalaxyClient\Games\Stardew Valley - C:\Program Files (x86)\GOG Galaxy\Games\Stardew Valley - C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley - - $([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\GOG.com\Games\1453375253', 'PATH', null, RegistryView.Registry32)) - $([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 413150', 'InstallLocation', null, RegistryView.Registry64, RegistryView.Registry32)) - - $(DefineConstants);SMAPI_FOR_WINDOWS diff --git a/build/find-game-folder.targets b/build/find-game-folder.targets new file mode 100644 index 00000000..a3c3f67b --- /dev/null +++ b/build/find-game-folder.targets @@ -0,0 +1,41 @@ + + + + + + + + + + + $(HOME)/GOG Games/Stardew Valley/game + $(HOME)/.steam/steam/steamapps/common/Stardew Valley + $(HOME)/.local/share/Steam/steamapps/common/Stardew Valley + + + /Applications/Stardew Valley.app/Contents/MacOS + $(HOME)/Library/Application Support/Steam/steamapps/common/Stardew Valley/Contents/MacOS + + + + + + C:\Program Files\GalaxyClient\Games\Stardew Valley + C:\Program Files\GOG Galaxy\Games\Stardew Valley + C:\Program Files\Steam\steamapps\common\Stardew Valley + + C:\Program Files (x86)\GalaxyClient\Games\Stardew Valley + C:\Program Files (x86)\GOG Galaxy\Games\Stardew Valley + C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley + + + $([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\GOG.com\Games\1453375253', 'PATH', null, RegistryView.Registry32)) + $([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 413150', 'InstallLocation', null, RegistryView.Registry64, RegistryView.Registry32)) + + + <_SteamLibraryPath>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Valve\Steam', 'SteamPath', null, RegistryView.Registry32)) + $(_SteamLibraryPath)\steamapps\common\Stardew Valley + + + + diff --git a/build/prepare-nuget-package.targets b/build/prepare-nuget-package.targets index cafaeda6..9c1d9c2a 100644 --- a/build/prepare-nuget-package.targets +++ b/build/prepare-nuget-package.targets @@ -11,6 +11,7 @@ + diff --git a/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj b/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj index 0af8eef9..70636937 100644 --- a/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj +++ b/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj @@ -15,6 +15,7 @@ + mod-build-config.md diff --git a/src/SMAPI.ModBuildConfig/build/smapi.targets b/src/SMAPI.ModBuildConfig/build/smapi.targets index c24990d5..10ef73af 100644 --- a/src/SMAPI.ModBuildConfig/build/smapi.targets +++ b/src/SMAPI.ModBuildConfig/build/smapi.targets @@ -1,17 +1,12 @@ - + + + - - - - - x86 @@ -33,42 +28,6 @@ False - - - - - - $(HOME)/GOG Games/Stardew Valley/game - $(HOME)/.steam/steam/steamapps/common/Stardew Valley - $(HOME)/.local/share/Steam/steamapps/common/Stardew Valley - - - /Applications/Stardew Valley.app/Contents/MacOS - $(HOME)/Library/Application Support/Steam/steamapps/common/Stardew Valley/Contents/MacOS - - - - - - C:\Program Files\GalaxyClient\Games\Stardew Valley - C:\Program Files\GOG Galaxy\Games\Stardew Valley - C:\Program Files\Steam\steamapps\common\Stardew Valley - - C:\Program Files (x86)\GalaxyClient\Games\Stardew Valley - C:\Program Files (x86)\GOG Galaxy\Games\Stardew Valley - C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley - - - $([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\GOG.com\Games\1453375253', 'PATH', null, RegistryView.Registry32)) - $([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 413150', 'InstallLocation', null, RegistryView.Registry64, RegistryView.Registry32)) - - - <_SteamLibraryPath>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Valve\Steam', 'SteamPath', null, RegistryView.Registry32)) - $(_SteamLibraryPath)\steamapps\common\Stardew Valley - - - - + $(AssemblySearchPaths);{GAC} $(DefineConstants);SMAPI_FOR_WINDOWS @@ -9,7 +10,7 @@ - + @@ -57,4 +58,5 @@ + diff --git a/src/SMAPI.ModBuildConfig/build/smapi.targets b/src/SMAPI.ModBuildConfig/build/smapi.targets index 10ef73af..7ee7aa21 100644 --- a/src/SMAPI.ModBuildConfig/build/smapi.targets +++ b/src/SMAPI.ModBuildConfig/build/smapi.targets @@ -138,7 +138,7 @@ - + -- cgit From a07e2de9a031f3d5e79202eeea726a65065f1481 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 19 Jun 2019 13:46:10 -0400 Subject: keep true/false capitalisation consistent in mod build package --- docs/mod-build-config.md | 16 ++++++++-------- src/SMAPI.ModBuildConfig/build/smapi.targets | 10 +++++----- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src/SMAPI.ModBuildConfig/build/smapi.targets') diff --git a/docs/mod-build-config.md b/docs/mod-build-config.md index 5b39e7aa..87e0cf30 100644 --- a/docs/mod-build-config.md +++ b/docs/mod-build-config.md @@ -46,7 +46,7 @@ Framework (Windows). It automatically adjusts depending on which OS you're compi The assemblies aren't copied to the build output, since mods loaded by SMAPI won't need them. For non-mod projects like unit tests, you can set this property: ```xml -True +true ``` ### Copy files into the `Mods` folder and create release zip @@ -82,7 +82,7 @@ You can change the folder name: Or disable deploying the files: ```xml -False +false ``` @@ -99,7 +99,7 @@ You can change the folder path where the zip is created: Or disable zip creation: ```xml -False +false ``` @@ -117,7 +117,7 @@ This is disabled on Linux/Mac due to limitations with the Mono wrapper. To disable game debugging (only needed for some non-mod projects): ```xml -False +false ``` ### Preconfigure common settings @@ -249,14 +249,14 @@ You can use the package in non-mod projects too (e.g. unit tests or framework DL the mod-related package features: ```xml -False -False -False +false +false +false ``` If you need to copy the referenced DLLs into your build output, add this too: ```xml -True +true ``` ## Release notes diff --git a/src/SMAPI.ModBuildConfig/build/smapi.targets b/src/SMAPI.ModBuildConfig/build/smapi.targets index 7ee7aa21..1f512400 100644 --- a/src/SMAPI.ModBuildConfig/build/smapi.targets +++ b/src/SMAPI.ModBuildConfig/build/smapi.targets @@ -22,10 +22,10 @@ $(MSBuildProjectName) $(TargetDir) - True - True - True - False + true + true + true + false @@ -86,7 +86,7 @@ - + Program $(GamePath)\StardewModdingAPI.exe $(GamePath) -- cgit From a54db1b33019645f862b0552ad2cd0700074c592 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 19 Jun 2019 13:47:05 -0400 Subject: add optional Harmony reference to mod build package --- docs/mod-build-config.md | 7 +++++++ src/SMAPI.ModBuildConfig/build/smapi.targets | 8 ++++++++ src/SMAPI.ModBuildConfig/package.nuspec | 1 + 3 files changed, 16 insertions(+) (limited to 'src/SMAPI.ModBuildConfig/build/smapi.targets') diff --git a/docs/mod-build-config.md b/docs/mod-build-config.md index 87e0cf30..9121c175 100644 --- a/docs/mod-build-config.md +++ b/docs/mod-build-config.md @@ -49,6 +49,12 @@ non-mod projects like unit tests, you can set this property: true ``` +If your mod uses [Harmony](https://github.com/pardeike/Harmony) (not recommended for most mods), +the package can add a reference to SMAPI's Harmony DLL for you: +```xml +true +``` + ### Copy files into the `Mods` folder and create release zip
Files considered part of your mod
@@ -269,6 +275,7 @@ If you need to copy the referenced DLLs into your build output, add this too: * added GAC to assembly search paths to fix references to XNA Framework. * Added option to disable game debugging config. * Added `.pdb` files to builds by default (to enable line numbers in error stack traces). +* Added optional Harmony reference. * Fixed `Newtonsoft.Json.pdb` included in release zips when Json.NET is referenced directly. * Fixed `` not working for `i18n` files. * Dropped support for older versions of SMAPI and Visual Studio. diff --git a/src/SMAPI.ModBuildConfig/build/smapi.targets b/src/SMAPI.ModBuildConfig/build/smapi.targets index 1f512400..0daf40a1 100644 --- a/src/SMAPI.ModBuildConfig/build/smapi.targets +++ b/src/SMAPI.ModBuildConfig/build/smapi.targets @@ -24,6 +24,7 @@ $(TargetDir) true true + false true false @@ -32,6 +33,13 @@ + + + $(GamePath)\smapi-internal\0Harmony.dll + false + true + + diff --git a/src/SMAPI.ModBuildConfig/package.nuspec b/src/SMAPI.ModBuildConfig/package.nuspec index 60f14efe..524cadfd 100644 --- a/src/SMAPI.ModBuildConfig/package.nuspec +++ b/src/SMAPI.ModBuildConfig/package.nuspec @@ -22,6 +22,7 @@ - added GAC to assembly search paths to fix references to XNA Framework. - Added option to disable game debugging config. - Added `.pdb` files to builds by default (to enable line numbers in error stack traces). + - Added optional Harmony reference. - Fixed `Newtonsoft.Json.pdb` included in release zips when Json.NET is referenced directly. - Fixed `<IgnoreModFilePatterns>` not working for `i18n` files. - Dropped support for older versions of SMAPI and Visual Studio. -- cgit From 62d0b3b32228e0c0e8b999578a147a9dd217fb06 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 19 Jun 2019 14:22:16 -0400 Subject: reduce duplication in mod build package --- src/SMAPI.ModBuildConfig/build/smapi.targets | 175 +++++++++++---------------- 1 file changed, 69 insertions(+), 106 deletions(-) (limited to 'src/SMAPI.ModBuildConfig/build/smapi.targets') diff --git a/src/SMAPI.ModBuildConfig/build/smapi.targets b/src/SMAPI.ModBuildConfig/build/smapi.targets index 0daf40a1..51432d96 100644 --- a/src/SMAPI.ModBuildConfig/build/smapi.targets +++ b/src/SMAPI.ModBuildConfig/build/smapi.targets @@ -26,133 +26,96 @@ true false true - false + false + + + + + Program + $(GamePath)\StardewModdingAPI.exe + $(GamePath) + + + $(GamePath)\$(GameExecutableName).exe + $(CopyModReferencesToBuildOutput) + + + $(GamePath)\StardewModdingAPI.exe + $(CopyModReferencesToBuildOutput) + + + $(GamePath)\smapi-internal\SMAPI.Toolkit.CoreInterfaces.dll + $(CopyModReferencesToBuildOutput) + + + $(GamePath)\xTile.dll + $(CopyModReferencesToBuildOutput) + $(GamePath)\smapi-internal\0Harmony.dll - false - true + $(CopyModReferencesToBuildOutput) + + + + + + + $(CopyModReferencesToBuildOutput) + + + $(CopyModReferencesToBuildOutput) + + + $(CopyModReferencesToBuildOutput) + + + $(CopyModReferencesToBuildOutput) + + + $(GamePath)\Netcode.dll + $(CopyModReferencesToBuildOutput) + + + $(GamePath)\StardewValley.GameData.dll + $(CopyModReferencesToBuildOutput) + + + + + + + $(GamePath)\MonoGame.Framework.dll + $(CopyModReferencesToBuildOutput) + + + $(GamePath)\StardewValley.GameData.MonoGame.dll + $(CopyModReferencesToBuildOutput) - - - - - - false - true - - - false - true - - - false - true - - - false - true - - - $(GamePath)\Netcode.dll - False - true - - - $(GamePath)\Stardew Valley.exe - false - true - - - $(GamePath)\StardewValley.GameData.dll - false - true - - - $(GamePath)\StardewModdingAPI.exe - false - true - - - $(GamePath)\smapi-internal\SMAPI.Toolkit.CoreInterfaces.dll - false - true - - - $(GamePath)\xTile.dll - false - false - true - - - - - - Program - $(GamePath)\StardewModdingAPI.exe - $(GamePath) - - - - - - - $(GamePath)\MonoGame.Framework.dll - false - false - true - - - $(GamePath)\StardewValley.exe - false - true - - - $(GamePath)\StardewValley.GameData.MonoGame.dll - false - true - - - $(GamePath)\StardewModdingAPI.exe - false - true - - - $(GamePath)\smapi-internal\SMAPI.Toolkit.CoreInterfaces.dll - false - true - - - $(GamePath)\xTile.dll - false - true - - - - - - - + - + + Date: Sat, 6 Jul 2019 01:04:05 -0400 Subject: group technical docs, add general shortcut for mod build package docs (#651) --- build/common.targets | 2 +- docs/README.md | 8 +- docs/mod-build-config.md | 369 -------------------- docs/release-notes.md | 4 +- docs/screenshots/code-analyzer-example.png | Bin 3473 -> 0 bytes docs/technical-docs.md | 105 ------ docs/technical/mod-package.md | 371 +++++++++++++++++++++ .../screenshots/code-analyzer-example.png | Bin 0 -> 3473 bytes docs/technical/smapi.md | 105 ++++++ docs/technical/web.md | 106 ++++++ docs/web-services.md | 104 ------ .../NetFieldAnalyzerTests.cs | 4 +- .../ObsoleteFieldAnalyzerTests.cs | 2 +- .../NetFieldAnalyzer.cs | 8 +- .../ObsoleteFieldAnalyzer.cs | 4 +- .../SMAPI.ModBuildConfig.csproj | 4 +- src/SMAPI.ModBuildConfig/build/smapi.targets | 2 +- src/SMAPI.ModBuildConfig/package.nuspec | 4 +- src/SMAPI.Web/Startup.cs | 2 +- src/SMAPI.sln | 11 +- 20 files changed, 612 insertions(+), 603 deletions(-) delete mode 100644 docs/mod-build-config.md delete mode 100644 docs/screenshots/code-analyzer-example.png delete mode 100644 docs/technical-docs.md create mode 100644 docs/technical/mod-package.md create mode 100644 docs/technical/screenshots/code-analyzer-example.png create mode 100644 docs/technical/smapi.md create mode 100644 docs/technical/web.md delete mode 100644 docs/web-services.md (limited to 'src/SMAPI.ModBuildConfig/build/smapi.targets') diff --git a/build/common.targets b/build/common.targets index 804f1ed3..59d5bfd2 100644 --- a/build/common.targets +++ b/build/common.targets @@ -10,7 +10,7 @@ - + diff --git a/docs/README.md b/docs/README.md index e4220de2..4b9c97a1 100644 --- a/docs/README.md +++ b/docs/README.md @@ -38,16 +38,16 @@ doesn't change any of your game files. It serves eight main purposes: something goes wrong. (Via the bundled SaveBackup mod.)_ ## Documentation -Have questions? Come [chat on Discord](https://discord.gg/KCJHWhX) with SMAPI developers and other -modders! +Have questions? Come [chat on Discord](https://stardewvalleywiki.com/Modding:Community) with SMAPI +developers and other modders! ### For players * [Player guide](https://stardewvalleywiki.com/Modding:Player_Guide) ### For modders * [Modding documentation](https://stardewvalleywiki.com/Modding:Index) -* [Mod build configuration](mod-build-config.md) +* [Mod build configuration](technical/mod-package.md) * [Release notes](release-notes.md) ### For SMAPI developers -* [Technical docs](technical-docs.md) +* [Technical docs](technical/smapi.md) diff --git a/docs/mod-build-config.md b/docs/mod-build-config.md deleted file mode 100644 index 6c8ea2fa..00000000 --- a/docs/mod-build-config.md +++ /dev/null @@ -1,369 +0,0 @@ -The **mod build package** is an open-source NuGet package which automates the MSBuild configuration -for SMAPI mods and related tools. The package is fully compatible with Linux, Mac, and Windows. - -## Contents -* [Use](#use) -* [Features](#features) - * [Detect game path](#detect-game-path) - * [Add assembly references](#add-assembly-references) - * [Copy files into the `Mods` folder and create release zip](#copy-files-into-the-mods-folder-and-create-release-zip) - * [Launch or debug game](#launch-or-debug-game) - * [Preconfigure common settings](#preconfigure-common-settings) - * [Add code warnings](#add-code-warnings) -* [Code warnings](#code-warnings) -* [Special cases](#special-cases) - * [Custom game path](#custom-game-path) - * [Non-mod projects](#non-mod-projects) -* [For SMAPI developers](#for-smapi-developers) -* [Release notes](#release-notes) - -## Use -1. Create an empty library project. -2. Reference the [`Pathoschild.Stardew.ModBuildConfig` NuGet package](https://www.nuget.org/packages/Pathoschild.Stardew.ModBuildConfig). -3. [Write your code](https://stardewvalleywiki.com/Modding:Creating_a_SMAPI_mod). -4. Compile on any platform. -5. Run the game to play with your mod. - -## Features -The package automatically makes the changes listed below. In some cases you can configure how it -works by editing your mod's `.csproj` file, and adding the given properties between the first -`` and `` tags. - -### Detect game path -The package finds your game folder by scanning the default install paths and Windows registry. It -adds two MSBuild properties for use in your `.csproj` file if needed: - -property | description --------- | ----------- -`$(GamePath)` | The absolute path to the detected game folder. -`$(GameExecutableName)` | The game's executable name for the current OS (`Stardew Valley` on Windows, or `StardewValley` on Linux/Mac). - -If you get a build error saying it can't find your game, see [_set the game path_](#set-the-game-path). - -### Add assembly references -The package adds assembly references to SMAPI, Stardew Valley, xTile, and MonoGame (Linux/Mac) or XNA -Framework (Windows). It automatically adjusts depending on which OS you're compiling it on. - -The assemblies aren't copied to the build output, since mods loaded by SMAPI won't need them. For -non-mod projects like unit tests, you can set this property: -```xml -true -``` - -If your mod uses [Harmony](https://github.com/pardeike/Harmony) (not recommended for most mods), -the package can add a reference to SMAPI's Harmony DLL for you: -```xml -true -``` - -### Copy files into the `Mods` folder and create release zip -
-
Files considered part of your mod
-
- -These files are selected by default: `manifest.json`, -[`i18n` files](https://stardewvalleywiki.com/Modding:Translations) (if any), the `assets` folder -(if any), and all files in the build output. You can select custom files by [adding them to the -build output](https://stackoverflow.com/a/10828462/262123). (If your project references another mod, -make sure the reference is [_not_ marked 'copy local'](https://msdn.microsoft.com/en-us/library/t1zz5y8c(v=vs.100).aspx).) - -You can deselect a file by removing it from the build output. For a default file, you can set the -property below to a comma-delimited list of regex patterns to ignore. For crossplatform -compatibility, you should replace path delimiters with `[/\\]`. - -```xml -\.txt$, \.pdf$, assets[/\\]paths.png -``` - -
-
Copy files into the `Mods` folder
-
- -The package copies the selected files into your game's `Mods` folder when you rebuild the code, -with a subfolder matching the mod's project name. - -You can change the folder name: -```xml -YourModName -``` - -Or disable deploying the files: -```xml -false -``` - -
-
Create release zip
-
- -The package adds a zip file in your project's `bin` folder when you rebuild the code, in the format -recommended for sites like Nexus Mods. The zip filename can be changed using `ModFolderName` above. - -You can change the folder path where the zip is created: -```xml -$(SolutionDir)\_releases -``` - -Or disable zip creation: -```xml -false -``` - -
-
- -### Launch or debug game -On Windows only, the package configures Visual Studio so you can launch the game and attach a -debugger using _Debug > Start Debugging_ or _Debug > Start Without Debugging_. This lets you [set -breakpoints](https://docs.microsoft.com/en-us/visualstudio/debugger/using-breakpoints?view=vs-2019) -in your code while the game is running, or [make simple changes to the mod code without needing to -restart the game](https://docs.microsoft.com/en-us/visualstudio/debugger/edit-and-continue?view=vs-2019). - -This is disabled on Linux/Mac due to limitations with the Mono wrapper. - -To disable game debugging (only needed for some non-mod projects): - -```xml -false -``` - -### Preconfigure common settings -The package automatically enables PDB files, so error logs show line numbers for simpler debugging. - -For projects using the simplified `.csproj` format, it also enables the GAC (to support XNA -Framework) and sets the build to x86 mode (to avoid 'mismatch between the processor architecture' warnings due to - the game being x86). - -### Add code warnings -The package runs code analysis on your mod and raises warnings for some common errors or pitfalls. -See [_code warnings_](#code-warnings) for more info. - -## Code warnings -### Overview -The NuGet package adds code warnings in Visual Studio specific to Stardew Valley. For example: -![](screenshots/code-analyzer-example.png) - -You can hide the warnings using the warning ID (shown under 'code' in the Error List). See... -* [for specific code](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives/preprocessor-pragma-warning); -* for a method using this attribute: - ```cs - [System.Diagnostics.CodeAnalysis.SuppressMessage("SMAPI.CommonErrors", "AvoidNetField")] - ``` -* for an entire project: - 1. Expand the _References_ node for the project in Visual Studio. - 2. Right-click on _Analyzers_ and choose _Open Active Rule Set_. - 4. Expand _StardewModdingAPI.ModBuildConfig.Analyzer_ and uncheck the warnings you want to hide. - -See below for help with each specific warning. - -### Avoid implicit net field cast -Warning text: -> This implicitly converts '{{expression}}' from {{net type}} to {{other type}}, but -> {{net type}} has unintuitive implicit conversion rules. Consider comparing against the actual -> value instead to avoid bugs. - -Stardew Valley uses net types (like `NetBool` and `NetInt`) to handle multiplayer sync. These types -can implicitly convert to their equivalent normal values (like `bool x = new NetBool()`), but their -conversion rules are unintuitive and error-prone. For example, -`item?.category == null && item?.category != null` can both be true at once, and -`building.indoors != null` can be true for a null value. - -Suggested fix: -* Some net fields have an equivalent non-net property like `monster.Health` (`int`) instead of - `monster.health` (`NetInt`). The package will add a separate [AvoidNetField](#avoid-net-field) warning for - these. Use the suggested property instead. -* For a reference type (i.e. one that can contain `null`), you can use the `.Value` property: - ```c# - if (building.indoors.Value == null) - ``` - Or convert the value before comparison: - ```c# - GameLocation indoors = building.indoors; - if(indoors == null) - // ... - ``` -* For a value type (i.e. one that can't contain `null`), check if the object is null (if applicable) - and compare with `.Value`: - ```cs - if (item != null && item.category.Value == 0) - ``` - -### Avoid net field -Warning text: -> '{{expression}}' is a {{net type}} field; consider using the {{property name}} property instead. - -Your code accesses a net field, which has some unusual behavior (see [AvoidImplicitNetFieldCast](#avoid-implicit-net-field-cast)). -This field has an equivalent non-net property that avoids those issues. - -Suggested fix: access the suggested property name instead. - -### Avoid obsolete field -Warning text: -> The '{{old field}}' field is obsolete and should be replaced with '{{new field}}'. - -Your code accesses a field which is obsolete or no longer works. Use the suggested field instead. - -## Special cases -### Custom 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: - - ```xml - - - PATH_HERE - - - ``` - - 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 ` - PATH_HERE - - ``` - - 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). - -You access the game path via `$(GamePath)` in MSBuild properties, if you need to reference another -file in the game folder. - -### Non-mod projects -You can use the package in non-mod projects too (e.g. unit tests or framework DLLs). Just disable -the mod-related package features: - -```xml -false -false -false -``` - -If you need to copy the referenced DLLs into your build output, add this too: -```xml -true -``` - -## For SMAPI developers -The mod build package consists of three projects: - -project | purpose -------------------------------------------------- | ---------------- -`StardewModdingAPI.ModBuildConfig` | Configures the build (references, deploying the mod files, setting up debugging, etc). -`StardewModdingAPI.ModBuildConfig.Analyzer` | Adds C# analyzers which show code warnings in Visual Studio. -`StardewModdingAPI.ModBuildConfig.Analyzer.Tests` | Unit tests for the C# analyzers. - -To prepare a build of the NuGet package: -1. Install the [NuGet CLI](https://docs.microsoft.com/en-us/nuget/install-nuget-client-tools#nugetexe-cli). -1. Change the version and release notes in `package.nuspec`. -2. Rebuild the solution in _Release_ mode. -3. Open a terminal in the `bin/Pathoschild.Stardew.ModBuildConfig` package and run this command: - ```bash - nuget.exe pack - ``` - -That will create a `Pathoschild.Stardew.ModBuildConfig-.nupkg` file in the same directory -which can be uploaded to NuGet or referenced directly. - -## Release notes -### Upcoming release -* Updated for SMAPI 3.0 and Stardew Valley 1.4. -* Added automatic support for `assets` folders. -* Added `$(GameExecutableName)` MSBuild variable. -* Added support for projects using the simplified `.csproj` format: - * platform target is now set to x86 automatically to avoid mismatching platform target warnings; - * added GAC to assembly search paths to fix references to XNA Framework. -* Added option to disable game debugging config. -* Added `.pdb` files to builds by default (to enable line numbers in error stack traces). -* Added optional Harmony reference. -* Fixed `Newtonsoft.Json.pdb` included in release zips when Json.NET is referenced directly. -* Fixed `` not working for `i18n` files. -* Dropped support for older versions of SMAPI and Visual Studio. - -### 2.2 -* Added support for SMAPI 2.8+ (still compatible with earlier versions). -* Added default game paths for 32-bit Windows. -* Fixed valid manifests marked invalid in some cases. - -### 2.1 -* Added support for Stardew Valley 1.3. -* Added support for non-mod projects. -* Added C# analyzers to warn about implicit conversions of Netcode fields in Stardew Valley 1.3. -* Added option to ignore files by regex pattern. -* Added reference to new SMAPI DLL. -* Fixed some game paths not detected by NuGet package. - -### 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. diff --git a/docs/release-notes.md b/docs/release-notes.md index efac8f41..3f955e78 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -1,3 +1,5 @@ +← [README](README.md) + # Release notes ## 3.0 (upcoming release) These changes have not been released yet. @@ -674,7 +676,7 @@ Released 14 October 2017 for Stardew Valley 1.2.30–1.2.33. * **Command-line install** For power users and mod managers, the SMAPI installer can now be scripted using command-line arguments - (see [technical docs](technical-docs.md#command-line-arguments)). + (see [technical docs](technical/smapi.md#command-line-arguments)). ### Change log For players: diff --git a/docs/screenshots/code-analyzer-example.png b/docs/screenshots/code-analyzer-example.png deleted file mode 100644 index de38f643..00000000 Binary files a/docs/screenshots/code-analyzer-example.png and /dev/null differ diff --git a/docs/technical-docs.md b/docs/technical-docs.md deleted file mode 100644 index 5ef6dfb1..00000000 --- a/docs/technical-docs.md +++ /dev/null @@ -1,105 +0,0 @@ -← [README](README.md) - -This file provides more technical documentation about SMAPI. If you only want to use or create -mods, this section isn't relevant to you; see the main README to use or create mods. - -This document is about SMAPI itself; see also [mod build package](mod-build-config.md) and -[web services](web-services.md). - -# Contents -* [Customisation](#customisation) - * [Configuration file](#configuration-file) - * [Command-line arguments](#command-line-arguments) - * [Compile flags](#compile-flags) -* [For SMAPI developers](#for-smapi-developers) - * [Compiling from source](#compiling-from-source) - * [Debugging a local build](#debugging-a-local-build) - * [Preparing a release](#preparing-a-release) -* [Release notes](#release-notes) - -## Customisation -### Configuration file -You can customise the SMAPI behaviour by editing the `smapi-internal/config.json` file in your game -folder. - -Basic fields: - -field | purpose ------------------ | ------- -`DeveloperMode` | Default `false` (except in _SMAPI for developers_ releases). Whether to enable features intended for mod developers (mainly more detailed console logging). -`CheckForUpdates` | Default `true`. Whether SMAPI should check for a newer version when you load the game. If a new version is available, a small message will appear in the console. This doesn't affect the load time even if your connection is offline or slow, because it happens in the background. -`VerboseLogging` | Default `false`. Whether SMAPI should log more information about the game context. -`ModData` | Internal metadata about SMAPI mods. Changing this isn't recommended and may destabilise your game. See documentation in the file. - -### Command-line arguments -The SMAPI installer recognises three command-line arguments: - -argument | purpose --------- | ------- -`--install` | Preselects the install action, skipping the prompt asking what the user wants to do. -`--uninstall` | Preselects the uninstall action, skipping the prompt asking what the user wants to do. -`--game-path "path"` | Specifies the full path to the folder containing the Stardew Valley executable, skipping automatic detection and any prompt to choose a path. If the path is not valid, the installer displays an error. - -SMAPI itself recognises two arguments, but these are intended for internal use or testing and may -change without warning. - -argument | purpose --------- | ------- -`--no-terminal` | SMAPI won't write anything to the console window. (Messages will still be written to the log file.) -`--mods-path` | The path to search for mods, if not the standard `Mods` folder. This can be a path relative to the game folder (like `--mods-path "Mods (test)"`) or an absolute path. - -### Compile flags -SMAPI uses a small number of conditional compilation constants, which you can set by editing the -`` element in `StardewModdingAPI.csproj`. Supported constants: - -flag | purpose ----- | ------- -`SMAPI_FOR_WINDOWS` | Whether SMAPI is being compiled on Windows for players on Windows. Set automatically in `crossplatform.targets`. - -## For SMAPI developers -### Compiling from source -Using an official SMAPI release is recommended for most users. - -SMAPI uses some C# 7 code, so you'll need at least -[Visual Studio 2017](https://www.visualstudio.com/vs/community/) on Windows, -[MonoDevelop 7.0](https://www.monodevelop.com/) on Linux, -[Visual Studio 2017 for Mac](https://www.visualstudio.com/vs/visual-studio-mac/), or an equivalent -IDE to compile it. It uses build configuration derived from the -[crossplatform mod config](https://github.com/Pathoschild/Stardew.ModBuildConfig#readme) to detect -your current OS automatically and load the correct references. Compile output will be placed in a -`bin` folder at the root of the git repository. - -### Debugging a local build -Rebuilding the solution in debug mode will copy the SMAPI files into your game folder. Starting -the `StardewModdingAPI` project with debugging from Visual Studio (on Mac or Windows) will launch -SMAPI with the debugger attached, so you can intercept errors and step through the code being -executed. This doesn't work in MonoDevelop on Linux, unfortunately. - -### Preparing a release -To prepare a crossplatform SMAPI release, you'll need to compile it on two platforms. See -[crossplatforming info](https://stardewvalleywiki.com/Modding:Modder_Guide/Test_and_Troubleshoot#Testing_on_all_platforms) -on the wiki for the first-time setup. - -1. Update the version number in `GlobalAssemblyInfo.cs` and `Constants::Version`. Make sure you use a - [semantic version](https://semver.org). Recommended format: - - build type | format | example - :--------- | :----------------------- | :------ - dev build | `-alpha.` | `3.0-alpha.20171230` - prerelease | `-beta.` | `3.0-beta.2` - release | `` | `3.0` - -2. In Windows: - 1. Rebuild the solution in Release mode. - 2. Copy `windows-install.*` from `bin/SMAPI installer` and `bin/SMAPI installer for developers` to - Linux/Mac. - -3. In Linux/Mac: - 1. Rebuild the solution in Release mode. - 2. Add the `windows-install.*` files to the `bin/SMAPI installer` and - `bin/SMAPI installer for developers` folders. - 3. Rename the folders to `SMAPI installer` and `SMAPI installer for developers`. - 4. Zip the two folders. - -## Release notes -See [release notes](release-notes.md). diff --git a/docs/technical/mod-package.md b/docs/technical/mod-package.md new file mode 100644 index 00000000..43682bfb --- /dev/null +++ b/docs/technical/mod-package.md @@ -0,0 +1,371 @@ +← [SMAPI](../README.md) + +The **mod build package** is an open-source NuGet package which automates the MSBuild configuration +for SMAPI mods and related tools. The package is fully compatible with Linux, Mac, and Windows. + +## Contents +* [Use](#use) +* [Features](#features) + * [Detect game path](#detect-game-path) + * [Add assembly references](#add-assembly-references) + * [Copy files into the `Mods` folder and create release zip](#copy-files-into-the-mods-folder-and-create-release-zip) + * [Launch or debug game](#launch-or-debug-game) + * [Preconfigure common settings](#preconfigure-common-settings) + * [Add code warnings](#add-code-warnings) +* [Code warnings](#code-warnings) +* [Special cases](#special-cases) + * [Custom game path](#custom-game-path) + * [Non-mod projects](#non-mod-projects) +* [For SMAPI developers](#for-smapi-developers) +* [Release notes](#release-notes) + +## Use +1. Create an empty library project. +2. Reference the [`Pathoschild.Stardew.ModBuildConfig` NuGet package](https://www.nuget.org/packages/Pathoschild.Stardew.ModBuildConfig). +3. [Write your code](https://stardewvalleywiki.com/Modding:Creating_a_SMAPI_mod). +4. Compile on any platform. +5. Run the game to play with your mod. + +## Features +The package automatically makes the changes listed below. In some cases you can configure how it +works by editing your mod's `.csproj` file, and adding the given properties between the first +`` and `` tags. + +### Detect game path +The package finds your game folder by scanning the default install paths and Windows registry. It +adds two MSBuild properties for use in your `.csproj` file if needed: + +property | description +-------- | ----------- +`$(GamePath)` | The absolute path to the detected game folder. +`$(GameExecutableName)` | The game's executable name for the current OS (`Stardew Valley` on Windows, or `StardewValley` on Linux/Mac). + +If you get a build error saying it can't find your game, see [_set the game path_](#set-the-game-path). + +### Add assembly references +The package adds assembly references to SMAPI, Stardew Valley, xTile, and MonoGame (Linux/Mac) or XNA +Framework (Windows). It automatically adjusts depending on which OS you're compiling it on. + +The assemblies aren't copied to the build output, since mods loaded by SMAPI won't need them. For +non-mod projects like unit tests, you can set this property: +```xml +true +``` + +If your mod uses [Harmony](https://github.com/pardeike/Harmony) (not recommended for most mods), +the package can add a reference to SMAPI's Harmony DLL for you: +```xml +true +``` + +### Copy files into the `Mods` folder and create release zip +
+
Files considered part of your mod
+
+ +These files are selected by default: `manifest.json`, +[`i18n` files](https://stardewvalleywiki.com/Modding:Translations) (if any), the `assets` folder +(if any), and all files in the build output. You can select custom files by [adding them to the +build output](https://stackoverflow.com/a/10828462/262123). (If your project references another mod, +make sure the reference is [_not_ marked 'copy local'](https://msdn.microsoft.com/en-us/library/t1zz5y8c(v=vs.100).aspx).) + +You can deselect a file by removing it from the build output. For a default file, you can set the +property below to a comma-delimited list of regex patterns to ignore. For crossplatform +compatibility, you should replace path delimiters with `[/\\]`. + +```xml +\.txt$, \.pdf$, assets[/\\]paths.png +``` + +
+
Copy files into the `Mods` folder
+
+ +The package copies the selected files into your game's `Mods` folder when you rebuild the code, +with a subfolder matching the mod's project name. + +You can change the folder name: +```xml +YourModName +``` + +Or disable deploying the files: +```xml +false +``` + +
+
Create release zip
+
+ +The package adds a zip file in your project's `bin` folder when you rebuild the code, in the format +recommended for sites like Nexus Mods. The zip filename can be changed using `ModFolderName` above. + +You can change the folder path where the zip is created: +```xml +$(SolutionDir)\_releases +``` + +Or disable zip creation: +```xml +false +``` + +
+
+ +### Launch or debug game +On Windows only, the package configures Visual Studio so you can launch the game and attach a +debugger using _Debug > Start Debugging_ or _Debug > Start Without Debugging_. This lets you [set +breakpoints](https://docs.microsoft.com/en-us/visualstudio/debugger/using-breakpoints?view=vs-2019) +in your code while the game is running, or [make simple changes to the mod code without needing to +restart the game](https://docs.microsoft.com/en-us/visualstudio/debugger/edit-and-continue?view=vs-2019). + +This is disabled on Linux/Mac due to limitations with the Mono wrapper. + +To disable game debugging (only needed for some non-mod projects): + +```xml +false +``` + +### Preconfigure common settings +The package automatically enables PDB files, so error logs show line numbers for simpler debugging. + +For projects using the simplified `.csproj` format, it also enables the GAC (to support XNA +Framework) and sets the build to x86 mode (to avoid 'mismatch between the processor architecture' warnings due to + the game being x86). + +### Add code warnings +The package runs code analysis on your mod and raises warnings for some common errors or pitfalls. +See [_code warnings_](#code-warnings) for more info. + +## Code warnings +### Overview +The NuGet package adds code warnings in Visual Studio specific to Stardew Valley. For example: +![](screenshots/code-analyzer-example.png) + +You can hide the warnings using the warning ID (shown under 'code' in the Error List). See... +* [for specific code](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives/preprocessor-pragma-warning); +* for a method using this attribute: + ```cs + [System.Diagnostics.CodeAnalysis.SuppressMessage("SMAPI.CommonErrors", "AvoidNetField")] + ``` +* for an entire project: + 1. Expand the _References_ node for the project in Visual Studio. + 2. Right-click on _Analyzers_ and choose _Open Active Rule Set_. + 4. Expand _StardewModdingAPI.ModBuildConfig.Analyzer_ and uncheck the warnings you want to hide. + +See below for help with each specific warning. + +### Avoid implicit net field cast +Warning text: +> This implicitly converts '{{expression}}' from {{net type}} to {{other type}}, but +> {{net type}} has unintuitive implicit conversion rules. Consider comparing against the actual +> value instead to avoid bugs. + +Stardew Valley uses net types (like `NetBool` and `NetInt`) to handle multiplayer sync. These types +can implicitly convert to their equivalent normal values (like `bool x = new NetBool()`), but their +conversion rules are unintuitive and error-prone. For example, +`item?.category == null && item?.category != null` can both be true at once, and +`building.indoors != null` can be true for a null value. + +Suggested fix: +* Some net fields have an equivalent non-net property like `monster.Health` (`int`) instead of + `monster.health` (`NetInt`). The package will add a separate [AvoidNetField](#avoid-net-field) warning for + these. Use the suggested property instead. +* For a reference type (i.e. one that can contain `null`), you can use the `.Value` property: + ```c# + if (building.indoors.Value == null) + ``` + Or convert the value before comparison: + ```c# + GameLocation indoors = building.indoors; + if(indoors == null) + // ... + ``` +* For a value type (i.e. one that can't contain `null`), check if the object is null (if applicable) + and compare with `.Value`: + ```cs + if (item != null && item.category.Value == 0) + ``` + +### Avoid net field +Warning text: +> '{{expression}}' is a {{net type}} field; consider using the {{property name}} property instead. + +Your code accesses a net field, which has some unusual behavior (see [AvoidImplicitNetFieldCast](#avoid-implicit-net-field-cast)). +This field has an equivalent non-net property that avoids those issues. + +Suggested fix: access the suggested property name instead. + +### Avoid obsolete field +Warning text: +> The '{{old field}}' field is obsolete and should be replaced with '{{new field}}'. + +Your code accesses a field which is obsolete or no longer works. Use the suggested field instead. + +## Special cases +### Custom 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: + + ```xml + + + PATH_HERE + + + ``` + + 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 ` + PATH_HERE + + ``` + + 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). + +You access the game path via `$(GamePath)` in MSBuild properties, if you need to reference another +file in the game folder. + +### Non-mod projects +You can use the package in non-mod projects too (e.g. unit tests or framework DLLs). Just disable +the mod-related package features: + +```xml +false +false +false +``` + +If you need to copy the referenced DLLs into your build output, add this too: +```xml +true +``` + +## For SMAPI developers +The mod build package consists of three projects: + +project | purpose +------------------------------------------------- | ---------------- +`StardewModdingAPI.ModBuildConfig` | Configures the build (references, deploying the mod files, setting up debugging, etc). +`StardewModdingAPI.ModBuildConfig.Analyzer` | Adds C# analyzers which show code warnings in Visual Studio. +`StardewModdingAPI.ModBuildConfig.Analyzer.Tests` | Unit tests for the C# analyzers. + +To prepare a build of the NuGet package: +1. Install the [NuGet CLI](https://docs.microsoft.com/en-us/nuget/install-nuget-client-tools#nugetexe-cli). +1. Change the version and release notes in `package.nuspec`. +2. Rebuild the solution in _Release_ mode. +3. Open a terminal in the `bin/Pathoschild.Stardew.ModBuildConfig` package and run this command: + ```bash + nuget.exe pack + ``` + +That will create a `Pathoschild.Stardew.ModBuildConfig-.nupkg` file in the same directory +which can be uploaded to NuGet or referenced directly. + +## Release notes +### Upcoming release +* Updated for SMAPI 3.0 and Stardew Valley 1.4. +* Added automatic support for `assets` folders. +* Added `$(GameExecutableName)` MSBuild variable. +* Added support for projects using the simplified `.csproj` format: + * platform target is now set to x86 automatically to avoid mismatching platform target warnings; + * added GAC to assembly search paths to fix references to XNA Framework. +* Added option to disable game debugging config. +* Added `.pdb` files to builds by default (to enable line numbers in error stack traces). +* Added optional Harmony reference. +* Fixed `Newtonsoft.Json.pdb` included in release zips when Json.NET is referenced directly. +* Fixed `` not working for `i18n` files. +* Dropped support for older versions of SMAPI and Visual Studio. + +### 2.2 +* Added support for SMAPI 2.8+ (still compatible with earlier versions). +* Added default game paths for 32-bit Windows. +* Fixed valid manifests marked invalid in some cases. + +### 2.1 +* Added support for Stardew Valley 1.3. +* Added support for non-mod projects. +* Added C# analyzers to warn about implicit conversions of Netcode fields in Stardew Valley 1.3. +* Added option to ignore files by regex pattern. +* Added reference to new SMAPI DLL. +* Fixed some game paths not detected by NuGet package. + +### 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. diff --git a/docs/technical/screenshots/code-analyzer-example.png b/docs/technical/screenshots/code-analyzer-example.png new file mode 100644 index 00000000..de38f643 Binary files /dev/null and b/docs/technical/screenshots/code-analyzer-example.png differ diff --git a/docs/technical/smapi.md b/docs/technical/smapi.md new file mode 100644 index 00000000..a006ff1a --- /dev/null +++ b/docs/technical/smapi.md @@ -0,0 +1,105 @@ +← [README](../README.md) + +This file provides more technical documentation about SMAPI. If you only want to use or create +mods, this section isn't relevant to you; see the main README to use or create mods. + +This document is about SMAPI itself; see also [mod build package](mod-package.md) and +[web services](web.md). + +# Contents +* [Customisation](#customisation) + * [Configuration file](#configuration-file) + * [Command-line arguments](#command-line-arguments) + * [Compile flags](#compile-flags) +* [For SMAPI developers](#for-smapi-developers) + * [Compiling from source](#compiling-from-source) + * [Debugging a local build](#debugging-a-local-build) + * [Preparing a release](#preparing-a-release) +* [Release notes](#release-notes) + +## Customisation +### Configuration file +You can customise the SMAPI behaviour by editing the `smapi-internal/config.json` file in your game +folder. + +Basic fields: + +field | purpose +----------------- | ------- +`DeveloperMode` | Default `false` (except in _SMAPI for developers_ releases). Whether to enable features intended for mod developers (mainly more detailed console logging). +`CheckForUpdates` | Default `true`. Whether SMAPI should check for a newer version when you load the game. If a new version is available, a small message will appear in the console. This doesn't affect the load time even if your connection is offline or slow, because it happens in the background. +`VerboseLogging` | Default `false`. Whether SMAPI should log more information about the game context. +`ModData` | Internal metadata about SMAPI mods. Changing this isn't recommended and may destabilise your game. See documentation in the file. + +### Command-line arguments +The SMAPI installer recognises three command-line arguments: + +argument | purpose +-------- | ------- +`--install` | Preselects the install action, skipping the prompt asking what the user wants to do. +`--uninstall` | Preselects the uninstall action, skipping the prompt asking what the user wants to do. +`--game-path "path"` | Specifies the full path to the folder containing the Stardew Valley executable, skipping automatic detection and any prompt to choose a path. If the path is not valid, the installer displays an error. + +SMAPI itself recognises two arguments, but these are intended for internal use or testing and may +change without warning. + +argument | purpose +-------- | ------- +`--no-terminal` | SMAPI won't write anything to the console window. (Messages will still be written to the log file.) +`--mods-path` | The path to search for mods, if not the standard `Mods` folder. This can be a path relative to the game folder (like `--mods-path "Mods (test)"`) or an absolute path. + +### Compile flags +SMAPI uses a small number of conditional compilation constants, which you can set by editing the +`` element in `StardewModdingAPI.csproj`. Supported constants: + +flag | purpose +---- | ------- +`SMAPI_FOR_WINDOWS` | Whether SMAPI is being compiled on Windows for players on Windows. Set automatically in `crossplatform.targets`. + +## For SMAPI developers +### Compiling from source +Using an official SMAPI release is recommended for most users. + +SMAPI uses some C# 7 code, so you'll need at least +[Visual Studio 2017](https://www.visualstudio.com/vs/community/) on Windows, +[MonoDevelop 7.0](https://www.monodevelop.com/) on Linux, +[Visual Studio 2017 for Mac](https://www.visualstudio.com/vs/visual-studio-mac/), or an equivalent +IDE to compile it. It uses build configuration derived from the +[crossplatform mod config](https://github.com/Pathoschild/Stardew.ModBuildConfig#readme) to detect +your current OS automatically and load the correct references. Compile output will be placed in a +`bin` folder at the root of the git repository. + +### Debugging a local build +Rebuilding the solution in debug mode will copy the SMAPI files into your game folder. Starting +the `StardewModdingAPI` project with debugging from Visual Studio (on Mac or Windows) will launch +SMAPI with the debugger attached, so you can intercept errors and step through the code being +executed. This doesn't work in MonoDevelop on Linux, unfortunately. + +### Preparing a release +To prepare a crossplatform SMAPI release, you'll need to compile it on two platforms. See +[crossplatforming info](https://stardewvalleywiki.com/Modding:Modder_Guide/Test_and_Troubleshoot#Testing_on_all_platforms) +on the wiki for the first-time setup. + +1. Update the version number in `GlobalAssemblyInfo.cs` and `Constants::Version`. Make sure you use a + [semantic version](https://semver.org). Recommended format: + + build type | format | example + :--------- | :----------------------- | :------ + dev build | `-alpha.` | `3.0-alpha.20171230` + prerelease | `-beta.` | `3.0-beta.2` + release | `` | `3.0` + +2. In Windows: + 1. Rebuild the solution in Release mode. + 2. Copy `windows-install.*` from `bin/SMAPI installer` and `bin/SMAPI installer for developers` to + Linux/Mac. + +3. In Linux/Mac: + 1. Rebuild the solution in Release mode. + 2. Add the `windows-install.*` files to the `bin/SMAPI installer` and + `bin/SMAPI installer for developers` folders. + 3. Rename the folders to `SMAPI installer` and `SMAPI installer for developers`. + 4. Zip the two folders. + +## Release notes +See [release notes](../release-notes.md). diff --git a/docs/technical/web.md b/docs/technical/web.md new file mode 100644 index 00000000..c8888623 --- /dev/null +++ b/docs/technical/web.md @@ -0,0 +1,106 @@ +← [README](../README.md) + +**SMAPI.Web** contains the code for the `smapi.io` website, including the mod compatibility list +and update check API. + +## Contents +* [Overview](#overview) + * [Log parser](#log-parser) + * [Web API](#web-api) +* [For SMAPI developers](#for-smapi-developers) + * [Local development](#local-development) + * [Deploying to Amazon Beanstalk](#deploying-to-amazon-beanstalk) + +## Overview +The `StardewModdingAPI.Web` project provides an API and web UI hosted at `*.smapi.io`. + +### Log parser +The log parser provides a web UI for uploading, parsing, and sharing SMAPI logs. The logs are +persisted in a compressed form to Pastebin. + +The log parser lives at https://log.smapi.io. + +### Web API +SMAPI provides a web API at `api.smapi.io` for use by SMAPI and external tools. The URL includes a +`{version}` token, which is the SMAPI version for backwards compatibility. This API is publicly +accessible but not officially released; it may change at any time. + +The API has one `/mods` endpoint. This provides mod info, including official versions and URLs +(from Chucklefish, GitHub, or Nexus), unofficial versions from the wiki, and optional mod metadata +from the wiki and SMAPI's internal data. This is used by SMAPI to perform update checks, and by +external tools to fetch mod data. + +The API accepts a `POST` request with the mods to match, each of which **must** specify an ID and +may _optionally_ specify [update keys](https://stardewvalleywiki.com/Modding:Modder_Guide/APIs/Manifest#Update_checks). +The API will automatically try to fetch known update keys from the wiki and internal data based on +the given ID. + +``` +POST https://api.smapi.io/v2.0/mods +{ + "mods": [ + { + "id": "Pathoschild.LookupAnything", + "updateKeys": [ "nexus:541", "chucklefish:4250" ] + } + ], + "includeExtendedMetadata": true +} +``` + +The API will automatically aggregate versions and errors. Each mod will include... +* an `id` (matching what you passed in); +* up to three versions: `main` (e.g. 'latest version' field on Nexus), `optional` if newer (e.g. + optional files on Nexus), and `unofficial` if newer (from the wiki); +* `metadata` with mod info crossreferenced from the wiki and internal data (only if you specified + `includeExtendedMetadata: true`); +* and `errors` containing any error messages that occurred while fetching data. + +For example: +``` +[ + { + "id": "Pathoschild.LookupAnything", + "main": { + "version": "1.19", + "url": "https://www.nexusmods.com/stardewvalley/mods/541" + }, + "metadata": { + "id": [ + "Pathoschild.LookupAnything", + "LookupAnything" + ], + "name": "Lookup Anything", + "nexusID": 541, + "gitHubRepo": "Pathoschild/StardewMods", + "compatibilityStatus": "Ok", + "compatibilitySummary": "✓ use latest version." + }, + "errors": [] + } +] +``` + +## For SMAPI developers +### Local development +`StardewModdingAPI.Web` is a regular ASP.NET MVC Core app, so you can just launch it from within +Visual Studio to run a local version. + +There are two differences when it's run locally: all endpoints use HTTP instead of HTTPS, and the +subdomain portion becomes a route (e.g. `log.smapi.io` → `localhost:59482/log`). + +Before running it locally, you need to enter your credentials in the `appsettings.Development.json` +file. See the next section for a description of each setting. This file is listed in `.gitignore` +to prevent accidentally committing credentials. + +### Deploying to Amazon Beanstalk +The app can be deployed to a standard Amazon Beanstalk IIS environment. When creating the +environment, make sure to specify the following environment properties: + +property name | description +------------------------------- | ----------------- +`LogParser:PastebinDevKey` | The [Pastebin developer key](https://pastebin.com/api#1) used to authenticate with the Pastebin API. +`LogParser:PastebinUserKey` | The [Pastebin user key](https://pastebin.com/api#8) used to authenticate with the Pastebin API. Can be left blank to post anonymously. +`LogParser:SectionUrl` | The root URL of the log page, like `https://log.smapi.io/`. +`ModUpdateCheck:GitHubPassword` | The password with which to authenticate to GitHub when fetching release info. +`ModUpdateCheck:GitHubUsername` | The username with which to authenticate to GitHub when fetching release info. diff --git a/docs/web-services.md b/docs/web-services.md deleted file mode 100644 index 601152de..00000000 --- a/docs/web-services.md +++ /dev/null @@ -1,104 +0,0 @@ -**SMAPI.Web** contains the code for the `smapi.io` website, including the mod compatibility list -and update check API. - -## Contents -* [Overview](#overview) - * [Log parser](#log-parser) - * [Web API](#web-api) -* [For SMAPI developers](#for-smapi-developers) - * [Local development](#local-development) - * [Deploying to Amazon Beanstalk](#deploying-to-amazon-beanstalk) - -## Overview -The `StardewModdingAPI.Web` project provides an API and web UI hosted at `*.smapi.io`. - -### Log parser -The log parser provides a web UI for uploading, parsing, and sharing SMAPI logs. The logs are -persisted in a compressed form to Pastebin. - -The log parser lives at https://log.smapi.io. - -### Web API -SMAPI provides a web API at `api.smapi.io` for use by SMAPI and external tools. The URL includes a -`{version}` token, which is the SMAPI version for backwards compatibility. This API is publicly -accessible but not officially released; it may change at any time. - -The API has one `/mods` endpoint. This provides mod info, including official versions and URLs -(from Chucklefish, GitHub, or Nexus), unofficial versions from the wiki, and optional mod metadata -from the wiki and SMAPI's internal data. This is used by SMAPI to perform update checks, and by -external tools to fetch mod data. - -The API accepts a `POST` request with the mods to match, each of which **must** specify an ID and -may _optionally_ specify [update keys](https://stardewvalleywiki.com/Modding:Modder_Guide/APIs/Manifest#Update_checks). -The API will automatically try to fetch known update keys from the wiki and internal data based on -the given ID. - -``` -POST https://api.smapi.io/v2.0/mods -{ - "mods": [ - { - "id": "Pathoschild.LookupAnything", - "updateKeys": [ "nexus:541", "chucklefish:4250" ] - } - ], - "includeExtendedMetadata": true -} -``` - -The API will automatically aggregate versions and errors. Each mod will include... -* an `id` (matching what you passed in); -* up to three versions: `main` (e.g. 'latest version' field on Nexus), `optional` if newer (e.g. - optional files on Nexus), and `unofficial` if newer (from the wiki); -* `metadata` with mod info crossreferenced from the wiki and internal data (only if you specified - `includeExtendedMetadata: true`); -* and `errors` containing any error messages that occurred while fetching data. - -For example: -``` -[ - { - "id": "Pathoschild.LookupAnything", - "main": { - "version": "1.19", - "url": "https://www.nexusmods.com/stardewvalley/mods/541" - }, - "metadata": { - "id": [ - "Pathoschild.LookupAnything", - "LookupAnything" - ], - "name": "Lookup Anything", - "nexusID": 541, - "gitHubRepo": "Pathoschild/StardewMods", - "compatibilityStatus": "Ok", - "compatibilitySummary": "✓ use latest version." - }, - "errors": [] - } -] -``` - -## For SMAPI developers -### Local development -`StardewModdingAPI.Web` is a regular ASP.NET MVC Core app, so you can just launch it from within -Visual Studio to run a local version. - -There are two differences when it's run locally: all endpoints use HTTP instead of HTTPS, and the -subdomain portion becomes a route (e.g. `log.smapi.io` → `localhost:59482/log`). - -Before running it locally, you need to enter your credentials in the `appsettings.Development.json` -file. See the next section for a description of each setting. This file is listed in `.gitignore` -to prevent accidentally committing credentials. - -### Deploying to Amazon Beanstalk -The app can be deployed to a standard Amazon Beanstalk IIS environment. When creating the -environment, make sure to specify the following environment properties: - -property name | description -------------------------------- | ----------------- -`LogParser:PastebinDevKey` | The [Pastebin developer key](https://pastebin.com/api#1) used to authenticate with the Pastebin API. -`LogParser:PastebinUserKey` | The [Pastebin user key](https://pastebin.com/api#8) used to authenticate with the Pastebin API. Can be left blank to post anonymously. -`LogParser:SectionUrl` | The root URL of the log page, like `https://log.smapi.io/`. -`ModUpdateCheck:GitHubPassword` | The password with which to authenticate to GitHub when fetching release info. -`ModUpdateCheck:GitHubUsername` | The username with which to authenticate to GitHub when fetching release info. diff --git a/src/SMAPI.ModBuildConfig.Analyzer.Tests/NetFieldAnalyzerTests.cs b/src/SMAPI.ModBuildConfig.Analyzer.Tests/NetFieldAnalyzerTests.cs index 85a77d15..89bd1be5 100644 --- a/src/SMAPI.ModBuildConfig.Analyzer.Tests/NetFieldAnalyzerTests.cs +++ b/src/SMAPI.ModBuildConfig.Analyzer.Tests/NetFieldAnalyzerTests.cs @@ -96,7 +96,7 @@ namespace SMAPI.ModBuildConfig.Analyzer.Tests DiagnosticResult expected = new DiagnosticResult { Id = "AvoidImplicitNetFieldCast", - Message = $"This implicitly converts '{expression}' from {fromType} to {toType}, but {fromType} has unintuitive implicit conversion rules. Consider comparing against the actual value instead to avoid bugs. See https://smapi.io/buildmsg/avoid-implicit-net-field-cast for details.", + Message = $"This implicitly converts '{expression}' from {fromType} to {toType}, but {fromType} has unintuitive implicit conversion rules. Consider comparing against the actual value instead to avoid bugs. See https://smapi.io/package/avoid-implicit-net-field-cast for details.", Severity = DiagnosticSeverity.Warning, Locations = new[] { new DiagnosticResultLocation("Test0.cs", NetFieldAnalyzerTests.SampleCodeLine, NetFieldAnalyzerTests.SampleCodeColumn + column) } }; @@ -138,7 +138,7 @@ namespace SMAPI.ModBuildConfig.Analyzer.Tests DiagnosticResult expected = new DiagnosticResult { Id = "AvoidNetField", - Message = $"'{expression}' is a {netType} field; consider using the {suggestedProperty} property instead. See https://smapi.io/buildmsg/avoid-net-field for details.", + Message = $"'{expression}' is a {netType} field; consider using the {suggestedProperty} property instead. See https://smapi.io/package/avoid-net-field for details.", Severity = DiagnosticSeverity.Warning, Locations = new[] { new DiagnosticResultLocation("Test0.cs", NetFieldAnalyzerTests.SampleCodeLine, NetFieldAnalyzerTests.SampleCodeColumn + column) } }; diff --git a/src/SMAPI.ModBuildConfig.Analyzer.Tests/ObsoleteFieldAnalyzerTests.cs b/src/SMAPI.ModBuildConfig.Analyzer.Tests/ObsoleteFieldAnalyzerTests.cs index fa9235a3..12641e1a 100644 --- a/src/SMAPI.ModBuildConfig.Analyzer.Tests/ObsoleteFieldAnalyzerTests.cs +++ b/src/SMAPI.ModBuildConfig.Analyzer.Tests/ObsoleteFieldAnalyzerTests.cs @@ -67,7 +67,7 @@ namespace SMAPI.ModBuildConfig.Analyzer.Tests DiagnosticResult expected = new DiagnosticResult { Id = "AvoidObsoleteField", - Message = $"The '{oldName}' field is obsolete and should be replaced with '{newName}'. See https://smapi.io/buildmsg/avoid-obsolete-field for details.", + Message = $"The '{oldName}' field is obsolete and should be replaced with '{newName}'. See https://smapi.io/package/avoid-obsolete-field for details.", Severity = DiagnosticSeverity.Warning, Locations = new[] { new DiagnosticResultLocation("Test0.cs", ObsoleteFieldAnalyzerTests.SampleCodeLine, ObsoleteFieldAnalyzerTests.SampleCodeColumn + column) } }; diff --git a/src/SMAPI.ModBuildConfig.Analyzer/NetFieldAnalyzer.cs b/src/SMAPI.ModBuildConfig.Analyzer/NetFieldAnalyzer.cs index f2608348..70c01418 100644 --- a/src/SMAPI.ModBuildConfig.Analyzer/NetFieldAnalyzer.cs +++ b/src/SMAPI.ModBuildConfig.Analyzer/NetFieldAnalyzer.cs @@ -135,22 +135,22 @@ namespace StardewModdingAPI.ModBuildConfig.Analyzer private readonly DiagnosticDescriptor AvoidImplicitNetFieldCastRule = new DiagnosticDescriptor( id: "AvoidImplicitNetFieldCast", title: "Netcode types shouldn't be implicitly converted", - messageFormat: "This implicitly converts '{0}' from {1} to {2}, but {1} has unintuitive implicit conversion rules. Consider comparing against the actual value instead to avoid bugs. See https://smapi.io/buildmsg/avoid-implicit-net-field-cast for details.", + messageFormat: "This implicitly converts '{0}' from {1} to {2}, but {1} has unintuitive implicit conversion rules. Consider comparing against the actual value instead to avoid bugs. See https://smapi.io/package/avoid-implicit-net-field-cast for details.", category: "SMAPI.CommonErrors", defaultSeverity: DiagnosticSeverity.Warning, isEnabledByDefault: true, - helpLinkUri: "https://smapi.io/buildmsg/avoid-implicit-net-field-cast" + helpLinkUri: "https://smapi.io/package/avoid-implicit-net-field-cast" ); /// The diagnostic info for an avoidable net field access. private readonly DiagnosticDescriptor AvoidNetFieldRule = new DiagnosticDescriptor( id: "AvoidNetField", title: "Avoid Netcode types when possible", - messageFormat: "'{0}' is a {1} field; consider using the {2} property instead. See https://smapi.io/buildmsg/avoid-net-field for details.", + messageFormat: "'{0}' is a {1} field; consider using the {2} property instead. See https://smapi.io/package/avoid-net-field for details.", category: "SMAPI.CommonErrors", defaultSeverity: DiagnosticSeverity.Warning, isEnabledByDefault: true, - helpLinkUri: "https://smapi.io/buildmsg/avoid-net-field" + helpLinkUri: "https://smapi.io/package/avoid-net-field" ); diff --git a/src/SMAPI.ModBuildConfig.Analyzer/ObsoleteFieldAnalyzer.cs b/src/SMAPI.ModBuildConfig.Analyzer/ObsoleteFieldAnalyzer.cs index f1a3ef75..6b935caa 100644 --- a/src/SMAPI.ModBuildConfig.Analyzer/ObsoleteFieldAnalyzer.cs +++ b/src/SMAPI.ModBuildConfig.Analyzer/ObsoleteFieldAnalyzer.cs @@ -27,11 +27,11 @@ namespace StardewModdingAPI.ModBuildConfig.Analyzer ["AvoidObsoleteField"] = new DiagnosticDescriptor( id: "AvoidObsoleteField", title: "Reference to obsolete field", - messageFormat: "The '{0}' field is obsolete and should be replaced with '{1}'. See https://smapi.io/buildmsg/avoid-obsolete-field for details.", + messageFormat: "The '{0}' field is obsolete and should be replaced with '{1}'. See https://smapi.io/package/avoid-obsolete-field for details.", category: "SMAPI.CommonErrors", defaultSeverity: DiagnosticSeverity.Warning, isEnabledByDefault: true, - helpLinkUri: "https://smapi.io/buildmsg/avoid-obsolete-field" + helpLinkUri: "https://smapi.io/package/avoid-obsolete-field" ) }; diff --git a/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj b/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj index 70636937..e13526f9 100644 --- a/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj +++ b/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj @@ -16,9 +16,7 @@ - - mod-build-config.md - + diff --git a/src/SMAPI.ModBuildConfig/build/smapi.targets b/src/SMAPI.ModBuildConfig/build/smapi.targets index 51432d96..5eeea91e 100644 --- a/src/SMAPI.ModBuildConfig/build/smapi.targets +++ b/src/SMAPI.ModBuildConfig/build/smapi.targets @@ -107,7 +107,7 @@ - + diff --git a/src/SMAPI.ModBuildConfig/package.nuspec b/src/SMAPI.ModBuildConfig/package.nuspec index 6779798d..ffa47fdb 100644 --- a/src/SMAPI.ModBuildConfig/package.nuspec +++ b/src/SMAPI.ModBuildConfig/package.nuspec @@ -9,9 +9,9 @@ false MIT - https://github.com/Pathoschild/SMAPI/blob/develop/docs/mod-build-config.md#readme + https://smapi.io/package/readme https://raw.githubusercontent.com/Pathoschild/SMAPI/develop/src/SMAPI.ModBuildConfig/assets/nuget-icon.png - Automates the build configuration for crossplatform Stardew Valley SMAPI mods. For SMAPI 2.11 or later. + Automates the build configuration for crossplatform Stardew Valley SMAPI mods. For SMAPI 3.0 or later. 3.0.0: - Updated for SMAPI 3.0 and Stardew Valley 1.4. diff --git a/src/SMAPI.Web/Startup.cs b/src/SMAPI.Web/Startup.cs index a2e47482..b409a81d 100644 --- a/src/SMAPI.Web/Startup.cs +++ b/src/SMAPI.Web/Startup.cs @@ -162,7 +162,7 @@ namespace StardewModdingAPI.Web // shortcut redirects redirects.Add(new RedirectToUrlRule(@"^/3\.0\.?$", "https://stardewvalleywiki.com/Modding:Migrate_to_SMAPI_3.0")); - redirects.Add(new RedirectToUrlRule(@"^/buildmsg(?:/?(.*))$", "https://github.com/Pathoschild/SMAPI/blob/develop/docs/mod-build-config.md#$1")); + redirects.Add(new RedirectToUrlRule(@"^/(?:buildmsg|package)(?:/?(.*))$", "https://github.com/Pathoschild/SMAPI/blob/develop/docs/technical/mod-package.md#$1")); // buildmsg deprecated, remove when SDV 1.4 is released redirects.Add(new RedirectToUrlRule(@"^/compat\.?$", "https://mods.smapi.io")); redirects.Add(new RedirectToUrlRule(@"^/docs\.?$", "https://stardewvalleywiki.com/Modding:Index")); redirects.Add(new RedirectToUrlRule(@"^/install\.?$", "https://stardewvalleywiki.com/Modding:Player_Guide/Getting_Started#Install_SMAPI")); diff --git a/src/SMAPI.sln b/src/SMAPI.sln index 08a47a46..8ee91b11 100644 --- a/src/SMAPI.sln +++ b/src/SMAPI.sln @@ -35,11 +35,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{09CF91E5 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{EB35A917-67B9-4EFA-8DFC-4FB49B3949BB}" ProjectSection(SolutionItems) = preProject - ..\docs\mod-build-config.md = ..\docs\mod-build-config.md ..\docs\README.md = ..\docs\README.md ..\docs\release-notes.md = ..\docs\release-notes.md - ..\docs\technical-docs.md = ..\docs\technical-docs.md - ..\docs\web-services.md = ..\docs\web-services.md + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "technical", "technical", "{5947303D-3512-413A-9009-7AC43F5D3513}" + ProjectSection(SolutionItems) = preProject + ..\docs\technical\mod-package.md = ..\docs\technical\mod-package.md + ..\docs\technical\smapi.md = ..\docs\technical\smapi.md + ..\docs\technical\web.md = ..\docs\technical\web.md EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Internal", "Internal", "{82D22ED7-A0A7-4D64-8E92-4B6A5E74ED11}" @@ -135,6 +139,7 @@ Global {F4453AB6-D7D6-447F-A973-956CC777968F} = {4B1CEB70-F756-4A57-AAE8-8CD78C475F25} {09CF91E5-5BAB-4650-A200-E5EA9A633046} = {86C452BE-D2D8-45B4-B63F-E329EB06CEDA} {EB35A917-67B9-4EFA-8DFC-4FB49B3949BB} = {86C452BE-D2D8-45B4-B63F-E329EB06CEDA} + {5947303D-3512-413A-9009-7AC43F5D3513} = {EB35A917-67B9-4EFA-8DFC-4FB49B3949BB} {85208F8D-6FD1-4531-BE05-7142490F59FE} = {82D22ED7-A0A7-4D64-8E92-4B6A5E74ED11} {680B2641-81EA-467C-86A5-0E81CDC57ED0} = {82D22ED7-A0A7-4D64-8E92-4B6A5E74ED11} {AA95884B-7097-476E-92C8-D0500DE9D6D1} = {82D22ED7-A0A7-4D64-8E92-4B6A5E74ED11} -- cgit From c6d4381142ef4e871a7b203c4c940a792bcd1a1e Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 8 Jul 2019 20:59:55 -0400 Subject: update for SDV 1.4 build change on Linux/Mac (#638) --- src/SMAPI.ModBuildConfig/build/smapi.targets | 12 +++---- src/SMAPI.ModBuildConfig/package.nuspec | 2 +- .../SMAPI.Mods.ConsoleCommands.csproj | 12 +++---- src/SMAPI/SMAPI.csproj | 42 +++++++++------------- 4 files changed, 26 insertions(+), 42 deletions(-) (limited to 'src/SMAPI.ModBuildConfig/build/smapi.targets') diff --git a/src/SMAPI.ModBuildConfig/build/smapi.targets b/src/SMAPI.ModBuildConfig/build/smapi.targets index 5eeea91e..78d3a3d4 100644 --- a/src/SMAPI.ModBuildConfig/build/smapi.targets +++ b/src/SMAPI.ModBuildConfig/build/smapi.targets @@ -46,6 +46,10 @@ $(GamePath)\$(GameExecutableName).exe $(CopyModReferencesToBuildOutput) + + $(GamePath)\StardewValley.GameData.dll + $(CopyModReferencesToBuildOutput) + $(GamePath)\StardewModdingAPI.exe $(CopyModReferencesToBuildOutput) @@ -82,10 +86,6 @@ $(GamePath)\Netcode.dll $(CopyModReferencesToBuildOutput) - - $(GamePath)\StardewValley.GameData.dll - $(CopyModReferencesToBuildOutput) - @@ -94,10 +94,6 @@ $(GamePath)\MonoGame.Framework.dll $(CopyModReferencesToBuildOutput) - - $(GamePath)\StardewValley.GameData.MonoGame.dll - $(CopyModReferencesToBuildOutput) - diff --git a/src/SMAPI.ModBuildConfig/package.nuspec b/src/SMAPI.ModBuildConfig/package.nuspec index ffa47fdb..76818c9f 100644 --- a/src/SMAPI.ModBuildConfig/package.nuspec +++ b/src/SMAPI.ModBuildConfig/package.nuspec @@ -2,7 +2,7 @@ Pathoschild.Stardew.ModBuildConfig - 3.0.0-beta.4 + 3.0.0-beta.6 Build package for SMAPI mods Pathoschild Pathoschild diff --git a/src/SMAPI.Mods.ConsoleCommands/SMAPI.Mods.ConsoleCommands.csproj b/src/SMAPI.Mods.ConsoleCommands/SMAPI.Mods.ConsoleCommands.csproj index 6cceb22d..80e1986e 100644 --- a/src/SMAPI.Mods.ConsoleCommands/SMAPI.Mods.ConsoleCommands.csproj +++ b/src/SMAPI.Mods.ConsoleCommands/SMAPI.Mods.ConsoleCommands.csproj @@ -22,16 +22,16 @@ $(GamePath)\$(GameExecutableName).exe False + + $(GamePath)\StardewValley.GameData.dll + False + - - $(GamePath)\StardewValley.GameData.dll - False - $(GamePath)\Netcode.dll False @@ -54,10 +54,6 @@ - - $(GamePath)\StardewValley.GameData.MonoGame.dll - False - $(GamePath)\MonoGame.Framework.dll False diff --git a/src/SMAPI/SMAPI.csproj b/src/SMAPI/SMAPI.csproj index 8b7d6277..994a8715 100644 --- a/src/SMAPI/SMAPI.csproj +++ b/src/SMAPI/SMAPI.csproj @@ -27,23 +27,34 @@ $(GamePath)\$(GameExecutableName).exe False + + $(GamePath)\StardewValley.GameData.dll + False + True True - + + $(GamePath)\GalaxyCSharp.dll + False + + + $(GamePath)\Lidgren.Network.dll + False + + + $(GamePath)\xTile.dll + False + - - $(GamePath)\StardewValley.GameData.dll - False - $(GamePath)\Netcode.dll False @@ -60,16 +71,13 @@ False + - - $(GamePath)\StardewValley.GameData.MonoGame.dll - False - $(GamePath)\MonoGame.Framework.dll False @@ -78,22 +86,6 @@ - - - - $(GamePath)\GalaxyCSharp.dll - False - - - $(GamePath)\Lidgren.Network.dll - False - - - $(GamePath)\xTile.dll - False - - - -- cgit From 730d9783959cc35945841ab721c930fad8ff9ca0 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 23 Nov 2019 22:39:57 -0500 Subject: drop mod build package change which sets the x86 platform Visual Studio changes platform inconsistently when set through a NuGet package, which can cause confusing behavior. It's better to set it directly in the project file instead. --- docs/technical/mod-package.md | 11 +++-------- src/SMAPI.ModBuildConfig/build/smapi.targets | 4 ---- src/SMAPI.ModBuildConfig/package.nuspec | 6 ++---- 3 files changed, 5 insertions(+), 16 deletions(-) (limited to 'src/SMAPI.ModBuildConfig/build/smapi.targets') diff --git a/docs/technical/mod-package.md b/docs/technical/mod-package.md index 43682bfb..a33480ad 100644 --- a/docs/technical/mod-package.md +++ b/docs/technical/mod-package.md @@ -130,11 +130,8 @@ To disable game debugging (only needed for some non-mod projects): ``` ### Preconfigure common settings -The package automatically enables PDB files, so error logs show line numbers for simpler debugging. - -For projects using the simplified `.csproj` format, it also enables the GAC (to support XNA -Framework) and sets the build to x86 mode (to avoid 'mismatch between the processor architecture' warnings due to - the game being x86). +The package also automatically enables PDB files (so error logs show line numbers for simpler +debugging), and enables support for the simplified `.csproj` format. ### Add code warnings The package runs code analysis on your mod and raises warnings for some common errors or pitfalls. @@ -294,9 +291,7 @@ which can be uploaded to NuGet or referenced directly. * Updated for SMAPI 3.0 and Stardew Valley 1.4. * Added automatic support for `assets` folders. * Added `$(GameExecutableName)` MSBuild variable. -* Added support for projects using the simplified `.csproj` format: - * platform target is now set to x86 automatically to avoid mismatching platform target warnings; - * added GAC to assembly search paths to fix references to XNA Framework. +* Added support for projects using the simplified `.csproj` format. * Added option to disable game debugging config. * Added `.pdb` files to builds by default (to enable line numbers in error stack traces). * Added optional Harmony reference. diff --git a/src/SMAPI.ModBuildConfig/build/smapi.targets b/src/SMAPI.ModBuildConfig/build/smapi.targets index 78d3a3d4..5ca9f032 100644 --- a/src/SMAPI.ModBuildConfig/build/smapi.targets +++ b/src/SMAPI.ModBuildConfig/build/smapi.targets @@ -8,10 +8,6 @@ ** Set build options **********************************************--> - - x86 - x86 - pdbonly true diff --git a/src/SMAPI.ModBuildConfig/package.nuspec b/src/SMAPI.ModBuildConfig/package.nuspec index 76818c9f..812e5bcb 100644 --- a/src/SMAPI.ModBuildConfig/package.nuspec +++ b/src/SMAPI.ModBuildConfig/package.nuspec @@ -2,7 +2,7 @@ Pathoschild.Stardew.ModBuildConfig - 3.0.0-beta.6 + 3.0.0 Build package for SMAPI mods Pathoschild Pathoschild @@ -17,9 +17,7 @@ - Updated for SMAPI 3.0 and Stardew Valley 1.4. - Added automatic support for 'assets' folders. - Added $(GameExecutableName) MSBuild variable. - - Added support for projects using the simplified .csproj format: - - platform target is now set to x86 automatically to avoid mismatching platform target warnings; - - added GAC to assembly search paths to fix references to XNA Framework. + - Added support for projects using the simplified .csproj format. - Added option to disable game debugging config. - Added .pdb files to builds by default (to enable line numbers in error stack traces). - Added optional Harmony reference. -- cgit