-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDirectory.Build.targets
More file actions
42 lines (34 loc) · 1.77 KB
/
Directory.Build.targets
File metadata and controls
42 lines (34 loc) · 1.77 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
<Project>
<Target Name="CompilePluginInfo" BeforeTargets="BeforeCompile;CoreCompile" Inputs="$(MSBuildAllProjects)" Outputs="$(IntermediateOutputPath)MyPluginInfo.cs">
<PropertyGroup>
<PluginGUID Condition="'$(PluginGUID)' == ''">dev.$([System.String]::Copy('$(Authors)').ToLower()).$([System.String]::Copy('$(AssemblyName)').ToLower())</PluginGUID>
<PluginName Condition="'$(PluginName)' == ''">$(Product)</PluginName>
<PluginVersion Condition="'$(PluginVersion)' == ''">$(Version)</PluginVersion>
<PluginVersion Condition="'$(PluginVersion)' != ''">$([System.Text.RegularExpressions.Regex]::Match($(PluginVersion), `[0-9]+\.[0-9]+\.[0-9]+`))</PluginVersion>
<GeneratedText><![CDATA[
#pragma warning disable CS1591
namespace $(RootNamespace)
{
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "$(PluginGUID)"%3B
public const string PLUGIN_NAME = "$(PluginName)"%3B
public const string PLUGIN_VERSION = "$(PluginVersion)"%3B
}
}
]]></GeneratedText>
<GeneratedFilePath>$(IntermediateOutputPath)MyPluginInfo.cs</GeneratedFilePath>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(GeneratedFilePath)"/>
<FileWrites Include="$(GeneratedFilePath)"/>
</ItemGroup>
<WriteLinesToFile Lines="$(GeneratedText)" File="$(GeneratedFilePath)" WriteOnlyWhenDifferent="true" Overwrite="true"/>
</Target>
<Target Name="CopyOutputToInstall" AfterTargets="PostBuildEvent" Condition="'$(PluginsPath)' != ''">
<ItemGroup>
<Files Include="$(TargetPath)" />
</ItemGroup>
<Copy SourceFiles="@(Files)" DestinationFolder="$(PluginsPath)/$(Authors)-$(TargetName)" />
</Target>
</Project>