Home > Software Deployment > C# DTF using locale .NET culture folder and .resources files for translations with MakeSFxCA.exe

C# DTF using locale .NET culture folder and .resources files for translations with MakeSFxCA.exe

Wow, that title is a mouthful.

One of the REALLY cool features of WiX DTF is that it uses MakeSFxCA.exe to create a self-extracting Dll that auto-magically bundles all your project dependencies into one DLL.  When called from your installer at run-time, the files are extracted to your %temp%\MSI*.tmp\ folder and your DLL is called.

But, we had a little bit of trouble getting the out-of-the-box setup to work with .NET localization.

To provide a little background: We’re using an Installshield 2011 Basic MSI project with the Wix Toolkit’s C# Deployment Tools Foundation (DTF) to fire a custom action in the UI Sequence.  The custom action dll displays a Winform of which we need to have localized for strings translations.

However, the out-of-the-box Visual Studio custom action project templates available to you after installing WiX do not properly deploy nested folder structures, which are a necessity for .NET localization.

To visualize, here’s the output of my project as compiled in Visual Studio… notice the .net culture sub-folder

..And here’s my %temp% folder it’s extracting to at runtime…   notice that it’s not respecting the sub-folder with the .net culture naming syntax, and just bundling it all in the same folder. (LocaleTest.resources.dll).  Without the .net culture sub-folder, the .resource file isn’t found and so it defaults back English at run-time.

After a lot of searching I stumbled upon this thread where a user had a similar question:

Is there a way to get MakeSfxCA include everything in my CA project ouput
directory recursively, maintaining folder structure?  It seems to me this
would be the simplest way of ensuring all necessary dependencies are there
at runtime.

The user dug through the source code of MakeSfxCA (yay for open-source!) and found some comments in the code that pointed him to the correct syntax:

Reading the source for MakeSfxCA I found the GetPackFileMap function and
reading the description:  “By default, all files will be placed in the root
of the cab. But inputs may optionally include an alternate inside-cab file
path before an equals sign.”

So this implied to me that on the MakeSfxCA command line, rather than pass ”
$(TargetDir)EULAs\ja-JP\Eula.rtf” I could pass “EULAs\en-US\Eula.rtf= 

I beleive the log output of MakeSfxCA confirmed this:
Packaging files

So, the syntax is to specify the <Virtual File Path at run-time>=<File On Disk>. (Just like a .cab or .zip file)

The user opened a WiX change request to have this fixed along with an updated wix.ca.targets.  However, Jason Ginchereau commented that it wasn’t such a great idea to make it the default behavior.

Here’s what we’ve done to overcome this limitation.  We’ve added the following .bat file as a post-build step to our project that hard codes the .resource files for inclusion into our resulting xxxCA.dll.  Yes, technically MakeSFxCA.exe is being called twice, but the end result is exactly what we needed.

%wix%SDK\MakeSfxCA.exe “$(TargetDir)$(TargetName).CA$(TargetExt)” “%wix%SDK\x86\SfxCA.dll” “$(TargetPath)” “$(TargetDir)Microsoft.Deployment.WindowsInstaller.dll” “$(TargetDir)Seagull.InstallWizard.dll”


REM Languages need to be added once they are available using the following syntax:


After adding the batch file as a post-build step, our translations display property at run-time in our custom UI.


  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: