-
Notifications
You must be signed in to change notification settings - Fork 4
/
Directory.Build.targets
41 lines (33 loc) · 1.72 KB
/
Directory.Build.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<Project>
<!-- Ensure the targets for Central package management are imported -->
<Import Project="Sdk.targets" Sdk="Microsoft.Build.CentralPackageVersions"/>
<ItemDefinitionGroup>
<NeedsGeneration>
<GeneratedFileName>%(Filename).Generated.cs</GeneratedFileName>
<Namespace>$(RootNamespace)</Namespace>
<ClassName>%(Filename)</ClassName>
<AccessModifier>internal</AccessModifier>
</NeedsGeneration>
</ItemDefinitionGroup>
<Target Name="ResourceGen">
<ItemGroup>
<NeedsGeneration Include="@(EmbeddedResource)" Condition="'%(EmbeddedResource.UseResourceGen)' == 'true'" />
</ItemGroup>
<Exec Condition="'@(NeedsGeneration)' != ''"
ContinueOnError="false"
ConsoleToMsBuild="true"
Command="pwsh -NoProfile -ExecutionPolicy Unrestricted -File $(MSBuildThisFileDirectory)build/scripts/GenerateResource.ps1 $([System.IO.Path]::GetFullPath(%(NeedsGeneration.Identity))) %(NeedsGeneration.GeneratedFileName) %(NeedsGeneration.Namespace) %(NeedsGeneration.ClassName) %(NeedsGeneration.AccessModifier)">
<Output TaskParameter="ConsoleOutput" PropertyName="OutputOfExec" />
</Exec>
</Target>
<Target Name="ValidateResourceGen" BeforeTargets="Build">
<ItemGroup>
<NeedsGeneration Include="@(EmbeddedResource)" Condition="'%(EmbeddedResource.UseResourceGen)' == 'true'" />
</ItemGroup>
<Exec Condition="'@(NeedsGeneration)' != ''"
ContinueOnError="false"
ConsoleToMsBuild="true"
Command="pwsh -NoProfile -ExecutionPolicy Unrestricted -File $(MSBuildThisFileDirectory)build/scripts/ValidateResource.ps1 $([System.IO.Path]::GetFullPath(%(NeedsGeneration.Identity))) %(NeedsGeneration.GeneratedFileName)">
</Exec>
</Target>
</Project>