PreBuild Automations
Add project references
Jötunn automatically references all dependencies that may be needed for the development process.
To overwrite paths, create a new file called Environment.props
at the project root and place the following contents inside, modify as needed.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Valheim install folder. This is usually found automatically, uncomment to overwrite.
Needs to be your path to the base Valheim folder. -->
<!-- <VALHEIM_INSTALL>X:\PathToYourSteamLibary\steamapps\common\Valheim</VALHEIM_INSTALL>-->
<!-- BepInEx install folder. This is usually found automatically, uncomment to overwrite.
Note the default value $(VALHEIM_INSTALL)\BepInEx requires the VALHEIM_INSTALL property to be set. -->
<!-- <BEPINEX_PATH>$(VALHEIM_INSTALL)\BepInEx</BEPINEX_PATH>-->
<!-- This is the folder where your build gets copied to when using the post-build automations.
Note the default value $(VALHEIM_INSTALL)\BepInEx\plugins requires the VALHEIM_INSTALL property to be set. -->
<!-- <MOD_DEPLOYPATH>$(VALHEIM_INSTALL)\BepInEx\plugins</MOD_DEPLOYPATH>-->
</PropertyGroup>
</Project>
Warning
This prebuild task will add references to your current project. If you already have setup that references it most certainly will duplicate them.
Publicize Valheim assemblies
Jötunn can automatically create the publicised assemblies for you. To use this feature you must have the Environment.props
file from the last step. Additionally you need to create a new file called DoPrebuild.props
in your solution directory. If you are using the ModStub the file will already be there so just change ExecutePrebuild
to true
. If you opt not to utilise this automation, you will need to generate your publicised assemblies, and add them to your projects references manually.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ExecutePrebuild>true</ExecutePrebuild>
</PropertyGroup>
</Project>
Warning
This prebuild task will automate the generation of publicising the game assemblies. By enabling this, you understand that you will be generating new publicised assemblies upon PreBuild IF the binaries have been updated since the last time the PreBuild has run.
Manual setup
If you decide to disable the prebuild, you will need to:
- Publicized assemblies are manually generated with AssemblyPublicizer. Please follow the instructions found on GitHub using the Valheim assembly DLLs found under
Valheim/valheim_Data/Managed
.
- Reference those publicized assemblies and any of the Unity assemblies you want to use (at the very least
UnityEngine.dll
) in your mod project.