dotnet-installer/build/GenerateResxSource.targets
2017-06-07 20:22:27 -07:00

49 lines
2 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;GatherXlf"
>
<ItemGroup>
<EmbeddedResource Condition="'%(EmbeddedResource.Namespace)' != ''">
<ManifestResourceName>%(EmbeddedResource.Namespace).%(EmbeddedResource.Filename)</ManifestResourceName>
</EmbeddedResource>
<XlfSource Condition="'%(XlfSource.Namespace)' != ''">
<ManifestResourceName>%(XlfSource.Namespace).%(XlfSource.Filename)</ManifestResourceName>
<XlfTranslatedFileName>%(XlfSource.Namespace).%(XlfSource.Filename)</XlfTranslatedFileName>
</XlfSource>
</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' and '%(EmbeddedResource.XlfLanguage)' == ''" />
<EmbeddedResourceSG>
<SourceOutputPath>$(IntermediateOutputPath)%(EmbeddedResourceSG.ManifestResourceName).cs</SourceOutputPath>
</EmbeddedResourceSG>
</ItemGroup>
</Target>
</Project>