Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8199539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:11:20+00:00 2026-06-07T06:11:20+00:00

I have a WPF application in C# that may need to be localized in

  • 0

I have a WPF application in C# that may need to be localized in the future. I want to support XAML/BAML localization and 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.)

I have read the relevant parts of the WPF Localization Guidance. I have set the UICulture property in the msbuild file. I have added the following line to AssemblyInfo.cs:

[assembly: NeutralResourcesLanguage("en", UltimateResourceFallbackLocation.Satellite)]

I understand that I need to copy Resources.resx as Resources.en.resx so that my localized resources get written to the satellite assembly.

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.

At the moment I must manually keep Resources.resx and Resources.en.resx synchronized. They must be identical. (Rick Stahl explains that here.)

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:

<Target Name="BeforeResGen">
    <Copy SourceFiles="@(CopyAsLocalizedResources)" DestinationFiles="$(IntermediateOutputPath)Resources.$(UICulture).resx">
        <Output ItemName="EmbeddedResource" TaskParameter="DestinationFiles"/>
    </Copy>
</Target>

I changed the Build Action for Resources.resx from None to CopyAsLocalizedResources.

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.

Can anyone help me achieve this using a modification to the project file?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T06:11:21+00:00Added an answer on June 7, 2026 at 6:11 am

    Eureka!

      <Target Name="CreateLocalizedResources" BeforeTargets="AssignTargetPaths">
        <Copy SourceFiles="@(CopyAsLocalizedResources)" DestinationFiles="$(IntermediateOutputPath)Resources.$(UICulture).resx" SkipUnchangedFiles="true" UseHardlinksIfPossible="true">
          <Output TaskParameter="DestinationFiles" ItemName="GeneratedLocalizedResources" />
        </Copy>
        <ItemGroup>
          <EmbeddedResource Include="@(GeneratedLocalizedResources)">
            <ManifestResourceName>$(RootNamespace).Properties.Resources.$(UICulture)</ManifestResourceName>
          </EmbeddedResource>
        </ItemGroup>
        <Message Text="Generated resources are: @(GeneratedLocalizedResources)" Importance="high" />
      </Target>
    

    I set the Build Action on my Resources.resx file to CopyAsLocalizedResources, and the custom build target handles tricking the build into making the proper satellite assembly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WPF application that I want to deploy to client PCs via
I have WPF C# application that communicate with a PLC (i.e. write/read Omron PLC's
I have a wpf application that is leaking memory...is there a way to detect
I have a WPF application that includes buttons with PNG images. The actual images
We have a WPF Application that runs from both desktop and as a XBAP
I have a WPF application that is a fullscreen kiosk app. It's actually a
I have a WPF application that's crashing once I get it onto machines that
I have a WPF application that will always run on windows 7, it opens
I have a WPF application that is using a WindowsFormsHost control to host a
I have a wpf application (C#) that needs to copy a file to a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.