dotnet-installer/build/GenerateResxSource.targets
2017-06-06 21:47:58 -07:00

45 lines
1.7 KiB
XML

<Project>
<UsingTask TaskName="GenerateResxSource" AssemblyFile="$(CLIBuildDll)" />
<Target Name="GenerateResxSource"
BeforeTargets="CoreCompile"
DependsOnTargets="PrepareResourceNames;
GetEmbeddedResourcesWithSourceGeneration;
BatchGenerateResxSource">
<ItemGroup>
<GeneratedResxSource Include="@(EmbeddedResourceSG->'%(SourceOutputPath)')" />
<FileWrites Include="@(GeneratedResxSource)" />
<Compile Include="@(GeneratedResxSource)" />
</ItemGroup>
</Target>
<Target Name="CustomizeResourceNames"
BeforeTargets="PrepareResourceNames"
>
<ItemGroup>
<EmbeddedResource>
<ManifestResourceName Condition="'%(EmbeddedResource.Namespace)' != ''">%(EmbeddedResource.Namespace).%(EmbeddedResource.Filename)</ManifestResourceName>
</EmbeddedResource>
</ItemGroup>
</Target>
<Target Name="BatchGenerateResxSource"
Inputs="@(EmbeddedResourceSG)"
Outputs="%(EmbeddedResourceSG.SourceOutputPath)"
>
<GenerateResxSource ResxFile="%(EmbeddedResourceSG.FullPath)"
ResourceName="%(EmbeddedResourceSG.ManifestResourceName)"
SourceOutputPath="%(EmbeddedResourceSG.SourceOutputPath)" />
</Target>
<Target Name="GetEmbeddedResourcesWithSourceGeneration">
<ItemGroup>
<EmbeddedResourceSG Include="@(EmbeddedResource)" Condition="'%(EmbeddedResource.GenerateSource)' == 'true'" />
<EmbeddedResourceSG>
<SourceOutputPath>$(IntermediateOutputPath)%(EmbeddedResourceSG.ManifestResourceName).cs</SourceOutputPath>
</EmbeddedResourceSG>
</ItemGroup>
</Target>
</Project>