title: How can I modify my C# project file so that Resources.resx is compiled into the satellite assembly for my UICulture?
body: <p>I have a WPF application in C# that may need to be localized in the future.  I want to support XAML/BAML localization <em>and</em> conventional resx localization.  (The former is useful for most of the code, but some localized content comes from the view model, where it is more straightforward to use resx files.)</p>
  
  <p>I have read the relevant parts of the <a href="http://wpflocalization.codeplex.com/" rel="nofollow">WPF Localization Guidance</a>.  I have set the UICulture property in the msbuild file.  I have added the following line to AssemblyInfo.cs:</p>
  
  <pre><code>[assembly: NeutralResourcesLanguage("en", UltimateResourceFallbackLocation.Satellite)]
  </code></pre>
  
  <p>I understand that I need to <em>copy</em> Resources.resx as Resources.en.resx so that my localized resources get written to the satellite assembly.</p>
  
  <p>I have set the build target on Resources.resx to None and on Resources.en.resx to EmbeddedResource.  The custom tool on Resources.resx is PublicResXFileCodeGenerator to generate the strongly typed resources class.  I know that the generator only works on a file that doesn't have a culture-specific suffix.</p>
  
  <p>At the moment I must manually keep Resources.resx and Resources.en.resx synchronized.  They must be identical.  (<a href="http://www.west-wind.com/weblog/posts/2009/Jun/04/Resx-and-BAML-Resources-in-WPF" rel="nofollow">Rick Stahl explains that here.</a>)</p>
  
  <p>I have tried to modify my C# project file to copy the file automatically.  However, I can't get this to work.  I'm no msbuild expert!  I added the following build target:</p>
  
  <pre><code>&lt;Target Name="BeforeResGen"&gt;
      &lt;Copy SourceFiles="@(CopyAsLocalizedResources)" DestinationFiles="$(IntermediateOutputPath)Resources.$(UICulture).resx"&gt;
          &lt;Output ItemName="EmbeddedResource" TaskParameter="DestinationFiles"/&gt;
      &lt;/Copy&gt;
  &lt;/Target&gt;
  </code></pre>
  
  <p>I changed the Build Action for Resources.resx from None to CopyAsLocalizedResources.</p>
  
  <p>I see my Resources.en.resx file being copied to the intermediate directory during build, but my resources aren't found at runtime, and I get an exception.  Presumaby they are never being compiled into the satellite assembly.</p>
  
  <p>Can anyone help me achieve this using a modification to the project file?</p>