A MSBuild Sdk for creating MelonLoader mods for Plants vs. Zombies™: Replanted.
PvZRSdk simplifies the development of MelonLoader mods for PvZ: Replanted by providing automated project setup, version control, deployment, and packaging through an MSBuild SDK.
To get started, see PvZRModTemplate.
- .NET 6.0 target framework
- Nullable reference types
- Implicit usings
- Latest C# language version
- x64 platform targeting
- Invariant globalization
- Base EditorConfig
- MinVer Integration: Automatically determines mod version from git tags
- Manual Override: Set
ModVersionproperty to override auto-detection
- Automatically generates metadata file during compilation
- Contains mod information:
- Name: Derived from RootNamespace
- Version: From
ModVersionproperty - Author: From
ModAuthorproperty - DownloadLink: From
ModDownloadLinkproperty
- Compiled directly into your DLL for easy access at runtime
- Validates
PvzReDirpath exists before compilation - Ensures MelonLoader is installed in the specified directory
- Copies compiled DLL to
{PvzReDir}\Modsfolder post-build
- Debug info: Emits debugging information into the .dll.
- Release zip: Creates
.zippackages automatically- Folder Structure: Maintains proper
Mods\hierarchy in zip
- Folder Structure: Maintains proper
Integrated code analyzers:
| Property | Type | Default Value | Description |
|---|---|---|---|
IsModBuild |
bool |
true |
Whether to apply mod-specific build targets (deployment, packaging, Melon References & Metadata). Set false for library projects. |
PvzReDir |
string |
C:\Program Files (x86)\Steam\steamapps\common\PVZ Replanted |
Path to PvZ: Replanted installation directory. |
ModVersion |
string |
(Auto-detected by MinVer) | Explicit mod version override. If empty, MinVer automatically determines version from git tags. |
ModAuthor |
string |
??? |
Mod creator/author name. |
ModDownloadLink |
string |
TODO |
Download or repo URL of the mod. |
ModMelonType |
string |
(Required) | Fully qualified type name of the mod class that inherits from MelonMod. |
ModColor |
string |
(Optional) | Color for the mod in the MelonLoader console. Format: ARGB (e.g., 255, 0, 200, 0). |
ModZipReplaceVersionDots |
bool |
(None) (false) |
Replace dots in version number with dashes in zip filename (e.g., MyMod_1.0.0.zip → MyMod_1-0-0.zip). |
ModEnvironmentReference |
Item |
(None) | Adds an assembly reference from $(PvzReDir)\MelonLoader\net6 (e.g., <ModEnvironmentReference Include="Microsoft.Extensions.Logging.dll" />). |
Versions are automatically determined from git tags:
# Create a version tag
git tag v1.0.0
git push origin v1.0.0
# Build will automatically use version 1.0.0
dotnet buildSee MinVer for additional configuration options.
If you need to bypass MinVer:
<PropertyGroup>
<ModVersion>1.0.0</ModVersion>
</PropertyGroup>