fix game assemblies not excluded from release zip when bundle type not set

This commit is contained in:
Jesse Plamondon-Willard 2023-01-07 17:55:15 -05:00
parent 81d3baa3b5
commit d35f45fc32
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
2 changed files with 18 additions and 6 deletions

View File

@ -414,6 +414,7 @@ when you compile it.
## Release notes ## Release notes
## Upcoming release ## Upcoming release
* Added `manifest.json` format validation on build (thanks to tylergibbs2!). * Added `manifest.json` format validation on build (thanks to tylergibbs2!).
* Fixed game assemblies no longer excluded from the release zip if referenced explicitly without setting `BundleExtraAssemblies`.
### 4.0.2 ### 4.0.2
Released 09 October 2022. Released 09 October 2022.

View File

@ -215,13 +215,24 @@ namespace StardewModdingAPI.ModBuildConfig.Framework
return true; return true;
} }
// check for bundled assembly types // ignore by assembly type
// When bundleAssemblyTypes is set, *all* dependencies are copied into the build output but only those which match the given assembly types should be bundled. ExtraAssemblyTypes type = this.GetExtraAssemblyType(file, modDllName);
if (bundleAssemblyTypes != ExtraAssemblyTypes.None) switch (bundleAssemblyTypes)
{ {
var type = this.GetExtraAssemblyType(file, modDllName); // Only explicitly-referenced assemblies are in the build output. These should be added to the zip,
// since it's possible the game won't load them (except game assemblies which will always be loaded
// separately). If they're already loaded, SMAPI will just ignore them.
case ExtraAssemblyTypes.None:
if (type is ExtraAssemblyTypes.Game)
return true;
break;
// All assemblies are in the build output (due to how .NET builds references), but only those which
// match the bundled type should be in the zip.
default:
if (type != ExtraAssemblyTypes.None && !bundleAssemblyTypes.HasFlag(type)) if (type != ExtraAssemblyTypes.None && !bundleAssemblyTypes.HasFlag(type))
return true; return true;
break;
} }
return false; return false;