Modding:Modder Guide/APIs/Manifest: Difference between revisions
imported>Pathoschild + private assemblies in SMAPI 4.1.0 |
imported>Margotbean ru link |
||
| (6 intermediate revisions by 4 users not shown) | |||
| Line 1: | Line 1: | ||
{{../../header}} | {{../../header}} | ||
Every SMAPI mod or content pack must have a <samp>manifest.json</samp> file in its folder. SMAPI uses this to identify and load the mod, perform update checks, etc. The manifest info is also available to any mod in code (using <samp>this.ModManifest</samp> for the current mod's manifest, or [[../#Mod registry|mod registry]] for other mods' manifests). | Every SMAPI mod or content pack must have a <samp>manifest.json</samp> file in its folder. SMAPI uses this to identify and load the mod, perform update checks, etc. The manifest info is also available to any mod in code (using <samp>this.ModManifest</samp> for the current mod's manifest, or [[../Integrations#Mod registry|mod registry]] for other mods' manifests). | ||
==Basic examples== | ==Basic examples== | ||
| Line 52: | Line 52: | ||
|- | |- | ||
| <samp>Version</samp> | | <samp>Version</samp> | ||
| The mod's [http://semver.org/ semantic version]. Make sure you update this for each release! SMAPI uses this for update checks, mod dependencies, and compatibility blacklists (if the mod breaks in a future version of the game). | | The mod's [http://semver.org/ semantic version]. Make sure you update this for each release! SMAPI uses this for update checks, mod dependencies, and compatibility blacklists (if the mod breaks in a future version of the game). For example: | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
"Version": "1.0.0" | "Version": "1.0.0" | ||
</syntaxhighlight> | </syntaxhighlight> | ||
If you set the <code><Version></code> in your <samp>.csproj</samp> project file, you can use the exact text <samp>%ProjectVersion%</samp> in the manifest file to set the same version automatically: | |||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
"Version": " | "Version": "%ProjectVersion%" | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| Line 114: | Line 116: | ||
==Specialized fields== | ==Specialized fields== | ||
'''⚠️ Most mods shouldn't need to use these fields.''' | '''⚠️ Most mods shouldn't need to use these fields.''' | ||
<!-- removed from SMAPI 4.1.0 | |||
===Private assemblies=== | ===Private assemblies=== | ||
{{SMAPI upcoming|4.1.0|content= | {{SMAPI upcoming|4.1.0|content= | ||
A ''private assembly'' is a DLL which only one mod can reference. This ensures that the mod has the exact version it was designed for, and lets different mods use different versions of the same assembly. You can use this even if the assembly was already loaded by SMAPI or another mod. | A ''private assembly'' is a DLL which only one mod can reference. This ensures that the mod has the exact version it was designed for, and lets different mods use different versions of the same assembly. You can use this even if another copy of the assembly was already loaded by SMAPI or another mod. | ||
Caveats: | Caveats: | ||
| Line 142: | Line 144: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
}} | }} | ||
--> | |||
===Anything else=== | ===Anything else=== | ||
Any other fields will be stored in the <samp>IManifest.ExtraFields</samp> dictionary, which is available through the [[../#Mod registry|mod registry]]. Extra fields are ignored by SMAPI, but may be useful for extended metadata intended for other mods. | Any other fields will be stored in the <samp>IManifest.ExtraFields</samp> dictionary, which is available through the [[../Integrations#Mod registry|mod registry]]. Extra fields are ignored by SMAPI, but may be useful for extended metadata intended for other mods. | ||
[[es:Modding:Guía del Modder/APIs/Manifest]] | [[es:Modding:Guía del Modder/APIs/Manifest]] | ||
[[ru:Модификации:Руководство мододела/API/Манифест]] | |||
[[tr:Modlama:Mod Rehberi/API'ler/Manifest]] | |||
[[zh:模组:制作指南/APIs/Manifest]] | [[zh:模组:制作指南/APIs/Manifest]] | ||
Latest revision as of 18:40, 7 January 2026
- Get started
- Game fundamentals
- Test & troubleshoot
- Release
- API reference
- Basic SMAPI APIs:
- Advanced SMAPI APIs:
- Specific guides
Every SMAPI mod or content pack must have a manifest.json file in its folder. SMAPI uses this to identify and load the mod, perform update checks, etc. The manifest info is also available to any mod in code (using this.ModManifest for the current mod's manifest, or mod registry for other mods' manifests).
Basic examples
Here's the basic format (see below for details on each field):
| For a SMAPI mod | For a content pack |
|---|---|
{
"Name": "Your Project Name",
"Author": "your name",
"Version": "1.0.0",
"Description": "One or two sentences about the mod.",
"UniqueID": "YourName.YourProjectName",
"EntryDll": "YourDllFileName.dll",
"UpdateKeys": []
}
|
{
"Name": "Your Project Name",
"Author": "your name",
"Version": "1.0.0",
"Description": "One or two sentences about the mod.",
"UniqueID": "YourName.YourProjectName",
"UpdateKeys": [],
"ContentPackFor": {
"UniqueID": "Pathoschild.ContentPatcher"
}
}
|
Fields
Basic fields
All mods should specify the following fields.
| field | description |
|---|---|
| Name | The mod name. SMAPI uses this in player messages, logs, and errors. Example: "Name": "Lookup Anything"
|
| Author | The name of the person who created the mod. Ideally this should include the username used to publish mods. Example: "Author": "Pathoschild"
|
| Version | The mod's semantic version. Make sure you update this for each release! SMAPI uses this for update checks, mod dependencies, and compatibility blacklists (if the mod breaks in a future version of the game). For example:
"Version": "1.0.0"
If you set the "Version": "%ProjectVersion%"
|
| Description | A short explanation of what your mod does (one or two sentences), shown in the SMAPI log. Example: "Description": "View metadata about anything by pressing a button."
|
| UniqueID | A unique identifier for your mod. The recommended format is <your name>.<mod name>, with no spaces or special characters. SMAPI uses this for update checks, mod dependencies, and compatibility blacklists (if the mod breaks in a future version of the game). When another mod needs to reference this mod, it uses the unique ID. For this reason, once you've published your mod, do not change this unique ID in future versions of the same mod. Example: "UniqueID": "Pathoschild.LookupAnything"
|
| EntryDll or ContentPackFor | All mods must specify either EntryDll (for a SMAPI mod) or ContentPackFor (for a content pack). These are mutually exclusive — you can't specify both. For a SMAPI mod, EntryDll is the mod's compiled DLL filename in its mod folder. Example:"EntryDll": "LookupAnything.dll"
For a content pack, ContentPackFor specifies which mod can read it. The MinimumVersion is optional. Example: "ContentPackFor": {
"UniqueID": "Pathoschild.ContentPatcher",
"MinimumVersion": "1.0.0"
}
|
Minimum SMAPI or game version
The MinimumApiVersion and MinimumGameVersion field sets the minimum version of SMAPI or Stardew Valley needed to use this mod. If a player tries to use the mod with an older version, they'll see a friendly message saying they need to update it.
For example:
"MinimumApiVersion": "4.0.0"
Dependencies
The Dependencies field specifies other mods required to use this mod. If a player tries to use the mod and the dependencies aren't installed, the mod won't be loaded and they'll see a friendly message saying they need to install those. For example:
"Dependencies": [
{
"UniqueID": "SMAPI.ConsoleCommands",
"MinimumVersion": "3.8.0" // optional. If specified, older versions won't meet the requirement.
}
]
You can mark a dependency as optional. It will be loaded first if it's installed, otherwise it'll be ignored.
"Dependencies": [
{
"UniqueID": "SMAPI.ConsoleCommands",
"IsRequired": false
}
]
Update checks
SMAPI can detect new versions of your mod and alert the user with a link to your mod page. You can enable this by setting the UpdateKeys field in your manifest.json, which tells SMAPI where to check.
See update checks for more information.
Specialized fields
⚠️ Most mods shouldn't need to use these fields.
Anything else
Any other fields will be stored in the IManifest.ExtraFields dictionary, which is available through the mod registry. Extra fields are ignored by SMAPI, but may be useful for extended metadata intended for other mods.