dotnet-installer/old/build/GenerateResxSource.targets
2018-10-21 20:47:58 -07:00

49 lines
2.1 KiB
XML

<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<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>