-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBaboonAPI.tasks
More file actions
38 lines (35 loc) · 1.74 KB
/
BaboonAPI.tasks
File metadata and controls
38 lines (35 loc) · 1.74 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
<Project>
<UsingTask TaskName="CopyManifest" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<SourceFile ParameterType="System.String" Required="true"/>
<Destination ParameterType="System.String" Required="true"/>
<Version ParameterType="System.String" Required="true"/>
</ParameterGroup>
<Task>
<Using Namespace="System"/>
<Using Namespace="System.IO"/>
<Code Type="Fragment" Language="cs">
<![CDATA[File.WriteAllText(Destination, File.ReadAllText(SourceFile).Replace("@version@", Version));]]>
</Code>
</Task>
</UsingTask>
<Target Name="AddGeneratedFile" BeforeTargets="BeforeCompile;CoreCompile" Inputs="$(MSBuildAllProjects)" Outputs="$(IntermediateOutputPath)GeneratedFile.fs">
<PropertyGroup>
<BepInExPluginName Condition="'$(BepInExPluginName)' == ''">$(Product)</BepInExPluginName>
<BepInExPluginVersion Condition="'$(BepInExPluginVersion)' == ''">$(Version)</BepInExPluginVersion>
<GeneratedText><![CDATA[
module $(RootNamespace).MyPluginInfo
[<Literal>]
let PluginName = "$(BepInExPluginName)"
[<Literal>]
let PluginVersion = "$(BepInExPluginVersion)"
]]></GeneratedText>
<GeneratedFilePath>$(IntermediateOutputPath)PluginInfo.fs</GeneratedFilePath>
</PropertyGroup>
<ItemGroup>
<CompileBefore Include="$(GeneratedFilePath)" />
<FileWrites Include="$(GeneratedFilePath)" />
</ItemGroup>
<WriteLinesToFile Lines="$(GeneratedText)" File="$(GeneratedFilePath)" WriteOnlyWhenDifferent="true" Overwrite="true" />
</Target>
</Project>