-
-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathDirectory.Build.props
More file actions
110 lines (102 loc) · 6.66 KB
/
Copy pathDirectory.Build.props
File metadata and controls
110 lines (102 loc) · 6.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?xml version="1.0" encoding="utf-8"?>
<Project>
<!--
Shared build settings for every project in this repo.
Target framework
Valheim 1.x runs on Unity 6 (6000.0.x) with the Mono backend. The Unity engine modules reference
netstandard 2.1 and the runtime mscorlib is .NET Standard 2.1 compatible (Span<T> etc.), so per the
BepInEx plugin guide (netstandard.dll present + Unity 2021.2 or newer) plugins target netstandard2.1.
Targeting net472/net48 fails to compile against Unity 6 APIs that expose ReadOnlySpan<T> overloads.
Paths
ValheimDir Valheim install. Override with -p:ValheimDir=... or the VALHEIM_DIR env var.
Falls back to the Steam registry entry, then the default Steam library path.
ValheimManaged <ValheimDir>\valheim_Data\Managed (Unity + game assemblies, used as compile refs)
BepInExDir Folder that contains BepInEx\ (a Gale/r2modman profile or the game folder).
Override with -p:BepInExDir=... or the BEPINEX_DIR env var.
BepInExCore <BepInExDir>\BepInEx\core (BepInEx.dll, 0Harmony.dll)
BepInExPlugins <BepInExDir>\BepInEx\plugins (deploy target)
AugaRefs <repo>\References (local, git-ignored; see References\README.md)
ValheimRefs <repo>\References\Valheim (publicized game assemblies, generated)
DeployToValheim copy build output into <BepInExPlugins> after building (default: true when BepInEx was found).
AugaTestProfile a second BepInEx install (the Gale profile "AugaAuto" by default) that also receives the plugin
and keeps the Tools\AugaAutoStart test helper installed. Override with -p:AugaTestProfile=...
BepInExExtraPlugins <AugaTestProfile>\BepInEx\plugins when that profile has BepInEx, otherwise empty.
-->
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<LangVersion>10</LangVersion>
<!-- Required with publicized game assemblies: makes the compiler emit the SkipVerification security request
(see Build\IgnoresAccessChecksTo.cs and https://github.com/Valheim-Modding/Wiki/wiki/Best-Practices). -->
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Deterministic>true</Deterministic>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
</PropertyGroup>
<PropertyGroup>
<ValheimDir Condition="'$(ValheimDir)' == ''">$(VALHEIM_DIR)</ValheimDir>
<ValheimDir Condition="'$(ValheimDir)' == '' Or !Exists('$(ValheimDir)')">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 892970', 'InstallLocation', null, RegistryView.Registry64, RegistryView.Registry32))</ValheimDir>
<ValheimDir Condition="'$(ValheimDir)' == '' Or !Exists('$(ValheimDir)')">C:\Program Files (x86)\Steam\steamapps\common\Valheim</ValheimDir>
<ValheimManaged>$(ValheimDir)\valheim_Data\Managed</ValheimManaged>
<!-- BepInEx install: a mod manager profile (Gale/r2modman) or the game folder. Override with -p:BepInExDir=... or BEPINEX_DIR. -->
<BepInExDir Condition="'$(BepInExDir)' == ''">$(BEPINEX_DIR)</BepInExDir>
<BepInExDir Condition="'$(BepInExDir)' == '' Or !Exists('$(BepInExDir)\BepInEx\core\BepInEx.dll')">$(APPDATA)\com.kesomannen.gale\valheim\profiles\Auga</BepInExDir>
<BepInExDir Condition="!Exists('$(BepInExDir)\BepInEx\core\BepInEx.dll')">$(ValheimDir)</BepInExDir>
<BepInExCore>$(BepInExDir)\BepInEx\core</BepInExCore>
<BepInExPlugins>$(BepInExDir)\BepInEx\plugins</BepInExPlugins>
<!-- Test profile: gets the plugin as well and is where the AugaAutoStart helper lives, so the main profile stays clean. -->
<AugaTestProfile Condition="'$(AugaTestProfile)' == ''">$(APPDATA)\com.kesomannen.gale\valheim\profiles\AugaAuto</AugaTestProfile>
<BepInExExtraPlugins Condition="'$(AugaTestProfile)' != '$(BepInExDir)' And Exists('$(AugaTestProfile)\BepInEx\core\BepInEx.dll')">$(AugaTestProfile)\BepInEx\plugins</BepInExExtraPlugins>
<AugaRefs>$(MSBuildThisFileDirectory)References</AugaRefs>
<ValheimRefs>$(AugaRefs)\Valheim</ValheimRefs>
<!-- Deploy the built plugin into $(BepInExPlugins) after each build (on by default when BepInEx was found). -->
<DeployToValheim Condition="'$(DeployToValheim)' == '' And Exists('$(BepInExCore)\BepInEx.dll')">true</DeployToValheim>
<DeployToValheim Condition="'$(DeployToValheim)' == ''">false</DeployToValheim>
</PropertyGroup>
<!--
Compile against the game's own class libraries (Unity Mono, .NET Standard 2.1 API surface) instead of the
NETStandard.Library reference pack. The game assemblies reference mscorlib 4.0 and the Unity engine modules
reference netstandard 2.1; the game's netstandard.dll is a facade over its mscorlib, so every type resolves
exactly as it does at runtime (Span<T>, System.Reflection.Emit.Label used by Harmony transpilers, ...).
-->
<PropertyGroup>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
<MSBuildWarningsAsMessages>$(MSBuildWarningsAsMessages);MSB3277</MSBuildWarningsAsMessages>
</PropertyGroup>
<ItemGroup>
<!-- Lets Mono skip accessibility checks for the publicized game assemblies (see the file for details). -->
<Compile Include="$(MSBuildThisFileDirectory)Build\IgnoresAccessChecksTo.cs" Link="Properties\IgnoresAccessChecksTo.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="netstandard">
<HintPath>$(ValheimManaged)\netstandard.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="mscorlib">
<HintPath>$(ValheimManaged)\mscorlib.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="System">
<HintPath>$(ValheimManaged)\System.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="System.Core">
<HintPath>$(ValheimManaged)\System.Core.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="System.Runtime">
<HintPath>$(ValheimManaged)\System.Runtime.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="System.Xml">
<HintPath>$(ValheimManaged)\System.Xml.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="System.Xml.Linq">
<HintPath>$(ValheimManaged)\System.Xml.Linq.dll</HintPath>
<Private>false</Private>
</Reference>
</ItemGroup>
</Project>