forked from SubnauticaNitrox/Nitrox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PreBuildtasks.targets
27 lines (26 loc) · 1.12 KB
/
PreBuildtasks.targets
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
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" InitialTargets="TestSubnauticaFolder">
<UsingTask
TaskName="WriteAssemblyPathTask"
TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll" >
<ParameterGroup>
<AssemblyFolder ParameterType="System.String" Required="true" />
<SettingsLocation ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System"/>
<Using Namespace="System.IO"/>
<Code Type="Fragment" Language="cs">
<![CDATA[
File.WriteAllText(SettingsLocation,
"namespace NitroxReloader{public static class ReloaderSettings{" +
"public const string Path = @\"" + AssemblyFolder + "\";}}");
]]>
</Code>
</Task>
</UsingTask>
<Target Name="AssemblyPathTask" BeforeTargets="BeforeBuild" Condition="'$(ProjectName)' == 'NitroxReloader'">
<WriteAssemblyPathTask AssemblyFolder="$([System.IO.Path]::GetFullPath($(OutputPath)))" SettingsLocation="$(ProjectDir)\ReloaderSettings.cs" />
</Target>
</Project>