title: Generation and Compilation of .resources files with MsBuild
body: <p>I have a process where I need to automate the process of generating the satellite assemblies. Specifically this is for WPF and combining Resx and BAML resources.</p>
  
  <p>I've got a build script that works, but it requires manual adding of the .resources files I want to combine with the BAML resources. IOW, I have to add to the build script each time I add a .Resx resource. Not cool!</p>
  
  <p>Currently I'm running the assembly linker manually and the script looks like this:</p>
  
  <pre><code>&lt;Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
    &lt;!-- Adds the build action 'LocBamlCsv' --&gt;
    &lt;ItemGroup&gt;
      &lt;AvailableItemName Include="LocBamlCsv" /&gt;
    &lt;/ItemGroup&gt;
  
  
    &lt;Target Name="CreateSatelliteAssemblies"
            DependsOnTargets="$(CreateSatelliteAssembliesDependsOn)"&gt;
  
      &lt;!-- Locbaml needs the runtime assemblies in the intermediate dir --&gt;
      &lt;Copy SourceFiles="$(ProjectDir)..\Tools\LocBaml.exe"
            DestinationFolder="$(OutputPath)" /&gt;
  
  
      &lt;!-- generate a .resources file for .csv merged output --&gt;
      &lt;Exec Command="LocBaml /generate ..\..\$(IntermediateOutputPath)$(TargetName).g.$(UICulture).resources /trans:%(LocBamlCsv.FullPath) /out:../../$(IntermediateOutputPath) /cul:%(LocBamlCsv.Culture)"
            WorkingDirectory="$(OutputPath)"
            Outputs="$(OutputPath)%(LocBamlCsv.Culture)\$(TargetName).$(UICulture).dll" /&gt;
  
      &lt;!-- Generate the resource assembly by merging all .resources files --&gt;
      &lt;!-- NOTE: Explicitly add any resource files here --&gt;
      &lt;Exec Command="al /template:$(TargetName).exe /culture:%(LocBamlCsv.Culture) /out:%(LocBamlCsv.Culture)\$(TargetName).resources.dll /embed:$(TargetName).g.%(LocBamlCsv.Culture).resources /embed:$(TargetName).Properties.Resources.%(LocBamlCsv.Culture).resources"
            WorkingDirectory="$(InterMediateOutputPath)"
            /&gt;
  
  
    &lt;/Target&gt;
  &lt;/Project&gt;
  </code></pre>
  
  <p>As mentioned it works. but the last command that calls al would be much easier to work with if there was some way to use wild cards (ie. $(TargetName).*s.%(LocBamlCsv.Culture).resources.</p>
  
  <p>I've tried a number of things. Using the  build process apparently fires at the wrong time and it ends up failing to find files. </p>