build: make a fresh clone build with nothing but the .NET SDK

Three things stood between a clean machine and a working build.

net48 reference assemblies now come from the Microsoft.NETFramework.ReferenceAssemblies
package, so the plain SDK is enough and no Visual Studio install is needed to
supply the targeting pack. Build-time only; nothing reaches the shipped DLL.

Jotunn publicizes the game assemblies and then references them, but it reads the
flag that enables it out of DoPrebuild.props, which its own Paths.props imports
through $(SolutionDir) - undefined on a `dotnet build` of this project, the same
trap that already caught the packaging target. The flag never arrived, the
publicizer never ran, and ten references failed to resolve on every build. It now
runs exactly when its output is missing: once on a fresh machine, never again,
and -p:ExecutePrebuild=true still forces it after a game update.

Jotunn 2.29.2 also references UnityEngine.ProfilerModule, which this build of
Valheim does not ship and nothing here uses. Dropped.

Build is clean: 0 errors, and the only warnings left are the pre-existing unused
locals and fields.
This commit is contained in:
kanym 2026-08-05 10:29:51 +02:00
commit 0afeaa7f0e

View file

@ -34,6 +34,9 @@
<Reference Include="assembly_valheim">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Valheim\valheim_Data\Managed\assembly_valheim.dll</HintPath>
</Reference>
<!-- Jotunn 2.29.2 references a Unity module this build of Valheim no longer ships, and the
unresolvable reference warned on every build. Nothing here uses it. -->
<Reference Remove="UnityEngine.ProfilerModule" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
@ -52,6 +55,10 @@
<ItemGroup>
<PackageReference Include="BepInEx.Core" Version="5.4.21" />
<PackageReference Include="JotunnLib" Version="2.29.2" />
<!-- net48 reference assemblies as a NuGet package, so the plain .NET SDK can build this
without a Visual Studio install supplying the targeting pack. Build-time only: it
contributes nothing to the shipped DLL. -->
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />
</ItemGroup>
<PropertyGroup>
@ -63,6 +70,14 @@
<VALHEIM_INSTALL Condition="'$(VALHEIM_INSTALL)' == ''">C:\Program Files (x86)\Steam\steamapps\common\Valheim</VALHEIM_INSTALL>
<BEPINEX_PATH Condition="'$(BEPINEX_PATH)' == ''">$(VALHEIM_INSTALL)\BepInEx</BEPINEX_PATH>
<VALHEIM_MANAGED>$(VALHEIM_INSTALL)/valheim_Data/Managed</VALHEIM_MANAGED>
<!-- Jotunn publicizes the game assemblies into valheim_Data\Managed\publicized_assemblies and
then references them. It reads this flag out of DoPrebuild.props, which its Paths.props
imports through $(SolutionDir) - undefined on a plain `dotnet build` of this project, so
the flag never arrived, the publicizer never ran, and every build warned about ten
references it could not resolve. Run it exactly when its output is missing: once on a
fresh machine, never again, and -p:ExecutePrebuild=true still forces it after a game
update. -->
<ExecutePrebuild Condition="!Exists('$(VALHEIM_MANAGED)/publicized_assemblies/assembly_valheim_publicized.dll')">true</ExecutePrebuild>
<!-- The one place the built mod is deployed. -->
<PLUGINS_PATH>$(BEPINEX_PATH)\plugins</PLUGINS_PATH>
<!-- SolutionDir is only defined when msbuild is handed a .sln, so it expanded to