This repository was archived by the owner on Feb 24, 2026. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 285
Expand file tree
/
Copy pathDirectory.Build.targets
More file actions
57 lines (51 loc) · 2.49 KB
/
Directory.Build.targets
File metadata and controls
57 lines (51 loc) · 2.49 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
<?xml version="1.0" encoding="utf-8" ?>
<Project>
<PropertyGroup>
<IsMainProject Condition="'$(MSBuildProjectName)' == 'iiMenu'">true</IsMainProject>
</PropertyGroup>
<!-- Update Game References -->
<Target Name="UpdateGameReferences" BeforeTargets="BeforeBuild" Condition="'$(IsMainProject)' == 'true' AND Exists('$(GameAssemblyPath)')">
<ItemGroup>
<GameAssemblyFiles Include="$(GameAssemblyPath)\**\*" />
</ItemGroup>
<Copy
SourceFiles="@(GameAssemblyFiles)"
DestinationFolder="$(ProjectDir)References\Managed\%(RecursiveDir)"
SkipUnchangedFiles="true" />
</Target>
<!-- Update BepInEx References -->
<Target Name="UpdateBepInExReferences" BeforeTargets="BeforeBuild" Condition="'$(IsMainProject)' == 'true' AND Exists('$(BepInExAssemblyPath)')">
<ItemGroup>
<BepInExAssemblyFiles Include="$(BepInExAssemblyPath)\**\*" />
</ItemGroup>
<Copy
SourceFiles="@(BepInExAssemblyFiles)"
DestinationFolder="$(ProjectDir)References\core\%(RecursiveDir)"
SkipUnchangedFiles="true" />
</Target>
<!-- Update Build Timestamp -->
<Target Name="UpdateBuildTimestamp" BeforeTargets="BeforeBuild" Condition="'$(IsMainProject)' == 'true'">
<PropertyGroup>
<OriginalFileContent>$([System.IO.File]::ReadAllText('$(MSBuildProjectDirectory)\PluginInfo.cs'))</OriginalFileContent>
<Pattern>public const string BuildTimestamp = ".*?";</Pattern>
<Replacement>public const string BuildTimestamp = "$(BuildTimestamp)";</Replacement>
<UpdatedFileContent>$([System.Text.RegularExpressions.Regex]::Replace($(OriginalFileContent), $(Pattern), $(Replacement)))</UpdatedFileContent>
</PropertyGroup>
<WriteLinesToFile
File="PluginInfo.cs"
Lines="$(UpdatedFileContent)"
Overwrite="true"
Encoding="UTF-8"
WriteOnlyWhenDifferent="true"/>
</Target>
<!-- Copy to Plugins -->
<Target Name="CopyToPlugins" AfterTargets="Build" Condition="'$(CI)' != 'TRUE'">
<ItemGroup>
<FilesToCopy Include="$(TargetPath)"/>
<FilesToCopy Include="$(TargetDir)$(TargetName).pdb" Condition="Exists('$(TargetDir)$(TargetName).pdb')"/>
<FilesToCopy Include="$(TargetDir)$(TargetName).dll" Condition="Exists('$(TargetDir)$(TargetName).dll')"/>
</ItemGroup>
<Copy SourceFiles="@(FilesToCopy)" DestinationFiles="@(FilesToCopy->'$(PluginsPath)\%(Filename)%(Extension)')"/>
<Message Text="Copied $(TargetFileName) and $(TargetName).pdb to Plugins" Importance="high"/>
</Target>
</Project>