-
-
Notifications
You must be signed in to change notification settings - Fork 7
Template Overview
Zingabopp edited this page Jan 13, 2020
·
9 revisions
All templates share the following features:
- The project will build as long as the Beat Saber references can be resolved (either by setting BeatSaberDir or adding the Reference Paths to the project properties).
-
BuildTargets.targets file that contains a collection of MSBuild Targets and Tasks. This file is self-contained and can be added to (probably) any Beat Saber mod project as long as
<Import Project="BuildTargets.targets" />
is added to the csproj or csproj.user file.- Targets:
-
CopyToPlugins: Copies the built assembly .dll and portable .pdb debug file to
<BeatSaberDir>\IPA\Pending\Plugins
. The mod will be loaded the next time the game is started.- If Beat Saber is run with the launch option --debug, logged Exception StackTraces will include file and line numbers.
-
ZipRelease: When the Release build configuration is selected, the mod will be zipped inside
bin\Release\zip
with a filename in the form of<AssemblyName>-<AssemblyVersion>-<BeatSaberGameVersion>-<GitShortCommitHash>.zip
(i.e.MyNewBeatSaberMod-0.0.1-bs1.6.2-361db64.zip
).- This zip file has the assembly inside the Plugins folder and is ready to upload to BeatMods.
- AssemblyVersion and BeatSaberGameVersion are read from the manifest.json.
- This build target will also check to make sure the mod version specified in the manifest.json matches the AssemblyVersion in AssemblyInfo.cs. If they don't match, a build error will be shown in the Error List.
-
CopyToPlugins: Copies the built assembly .dll and portable .pdb debug file to
- Tasks:
-
GetManifestInfo(out string GameVersion, out string PluginVersion, out string AssemblyVersion)
- Parses the manifest.json in the project's root folder and AssemblyInfo.cs and returns the GameVersion, PluginVersion, and AssemblyVersion.
- Outputs build error messages if it's unable to parse the files or the GameVersion and AssemblyVersion don't match.
-
ZipDir(string DirectoryName, string ZipFileName)
- Creates a zip from the contents of the Directory specified in DirectoryName (the ZipRelease build target creates a
Plugins
folder inside that directory containing the mod assembly). - The zip file uses the name specified by ZipFileName.
- Creates a zip from the contents of the Directory specified in DirectoryName (the ZipRelease build target creates a
-
GetCommitHash(string ProjectDir, out string CommitShortHash)
- Uses the
git
command with ProjectDir as the process's WorkingDirectory to determine the current commit hash, taking the first 7 characters. - Returns
local
if it is unable to retrieve a git hash.
- Uses the
-
GetManifestInfo(out string GameVersion, out string PluginVersion, out string AssemblyVersion)
- Targets: