summaryrefslogtreecommitdiff
path: root/src/mscorlib/GenerateSplitStringResources.targets
blob: 6041cbe0e317fb678a5e520798e03d698ba46d18 (plain)
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 xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <PrepareResourcesDependsOn>GenerateSplitStringResources;$(PrepareResourcesDependsOn)</PrepareResourcesDependsOn>
  </PropertyGroup>

  <PropertyGroup>
    <PreprocessFileTaskAsssemblyPath Condition="'$(PreprocessFileTaskAsssemblyPath)' == ''">$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll</PreprocessFileTaskAsssemblyPath>
  </PropertyGroup>

  <UsingTask TaskName="PreprocessFile" AssemblyFile="$(PreprocessFileTaskAsssemblyPath)" />

  <Target Name="GenerateSplitStringResources"
          Inputs="@(SplitTextStringResource)"
          Outputs="@(SplitTextStringResource->'$(IntermediateOutputPath)%(Filename).txt')">
         
    <ItemGroup>
      <Internal_ResGenDefines Remove="@(Internal_ResGenDefines)" />
      <Internal_ResGenDefines Include="INCLUDE_DEBUG" />
      <Internal_ResGenDefines Include="INCLUDE_RUNTIME" />
      <Internal_ResGenDefines Include="%(SplitTextStringResource.ResGenDefines)" />
    </ItemGroup>    

    <PreprocessFile SourceFile="%(SplitTextStringResource.Identity)" OutputFile="$(IntermediateOutputPath)%(SplitTextStringResource.Filename).txt" Defines="@(Internal_ResGenDefines)" />

    <GenerateResource Sources="$(IntermediateOutputPath)%(SplitTextStringResource.Filename).txt"
                      OutputResources="$(IntermediateOutputPath)%(SplitTextStringResource.Filename).resources"
                      ExecuteAsTool="false" />

    <ItemGroup>
      <EmbeddedResource Include="@(SplitTextStringResource->'$(IntermediateOutputPath)%(Filename).resources')">
        <WithCulture>false</WithCulture>
        <ManifestResourceName>%(Filename)</ManifestResourceName>
      </EmbeddedResource>
      <Clean Include="$(IntermediateOutputPath)%(SplitTextStringResource.Filename).txt" />
      <Clean Include="$(IntermediateOutputPath)%(SplitTextStringResource.Filename).resources" />
    </ItemGroup>

    <ItemGroup>
      <Internal_ResGenDefines Remove="@(Internal_ResGenDefines)" />
    </ItemGroup>    
  </Target>
</Project>