-
Notifications
You must be signed in to change notification settings - Fork 0
/
LordFanger.RimLanguageHotReload.csproj
68 lines (59 loc) · 3.29 KB
/
LordFanger.RimLanguageHotReload.csproj
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
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net48</TargetFrameworks>
<LangVersion>8</LangVersion>
<RootNamespace>LordFanger</RootNamespace>
<!-- Folder where RimWolrd is eg. C:\Program Files (x86)\Steam\steamapps\common\RimWorld\ -->
<RimWorldSteamFolder Condition="'$(RimWorldSteamFolder)' == ''">C:\Program Files (x86)\Steam\steamapps\common\RimWorld\</RimWorldSteamFolder>
<RimWorldVersion Condition="'$(RimWorldVersion)' == ''">1.5</RimWorldVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>$(RimWorldSteamFolder)RimWorldWin64_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
</ItemGroup>
<Target Name="LordFanger_ReleaseBuild" AfterTargets="Build" Condition="'$(Configuration)' != 'Release' AND $(Path.Contains('\dotnet'))">
<Message Text="path: $(ProjectPath)"/>
<Exec Command="dotnet build "$(MSBuildProjectFullPath)" -c Release"/>
</Target>
<Target Name="LordFanger_Deploy" AfterTargets="Build" Condition="'$(Configuration)' == 'Release' AND '$(TargetDir)' != ''">
<PropertyGroup>
<LordFanger_ModName>$(MSBuildProjectName)</LordFanger_ModName>
</PropertyGroup>
<Error Text="RimWorld folder not set" Condition="'$(RimWorldSteamFolder)' == ''"/>
<Error Text="RimWorld version not set" Condition="'$(RimWorldVersion)' == ''"/>
<Error Text="Mod name not set" Condition="'$(LordFanger_ModName)' == ''"/>
<Error Text="Mod directory not set" Condition="'$(MSBuildProjectDirectory)' == ''"/>
<!-- Removing old mod -->
<RemoveDir Directories="$(RimWorldSteamFolder)Mods\$(LordFanger_ModName)"/>
<!-- LordFanger.RimLanguageHotReload.dll -->
<Copy SourceFiles="$(TargetDir)$(TargetFileName)" DestinationFolder="$(RimWorldSteamFolder)Mods\$(LordFanger_ModName)\$(RimWorldVersion)\Assemblies"/>
<!-- about.xml -->
<Copy SourceFiles="$(MSBuildProjectDirectory)\about.xml" DestinationFolder="$(RimWorldSteamFolder)Mods\$(LordFanger_ModName)\About"/>
<LordFanger_AboutXmlReplace Path="$(RimWorldSteamFolder)Mods\$(LordFanger_ModName)\About\about.xml"/>
<!-- Preview.png -->
<Copy SourceFiles="$(MSBuildProjectDirectory)\Preview.png" DestinationFolder="$(RimWorldSteamFolder)Mods\$(LordFanger_ModName)\About"/>
<!-- PublishedFileId.txt -->
<Copy SourceFiles="$(MSBuildProjectDirectory)\PublishedFileId.txt" DestinationFolder="$(RimWorldSteamFolder)Mods\$(LordFanger_ModName)\About"/>
<!-- Older versions -->
<ItemGroup>
<LordFanger_LegacyItem Include="$(MSBuildProjectDirectory)\Legacy\**\*.*"/>
</ItemGroup>
<Copy SourceFiles="@(LordFanger_LegacyItem)" DestinationFiles="$(RimWorldSteamFolder)Mods\$(LordFanger_ModName)\%(RecursiveDir)%(Filename)%(Extension)" />
</Target>
<!-- Modify about.xml -->
<UsingTask TaskName="LordFanger_AboutXmlReplace" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<Path ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Code Type="Fragment" Language="cs">
<![CDATA[
string content = File.ReadAllText(Path);
content = content.Replace("$DATE_TIME$", DateTime.Now.ToString("HH:mm d.M.yyyy"));
File.WriteAllText(Path, content);
]]>
</Code>
</Task>
</UsingTask>
</Project>