Why Do I Get an Error Complaining about UICulture?

Why Do I Get an Error Complaining about UICulture?

  • Comments 3

There's a breaking change in the Beta 1 RC release of Avalon that many people have run across when upgrading projects from a previous release, so I wanted to document it here in the hope of saving someone some trouble and delay in the future.

The symptom is this: you have a XAML file that contains a locally-defined type; when you compile the project, an error message is displayed that looks something like the following:

D:\WINDOWS\Microsoft.NET\Framework\v2.0.50215\
Microsoft.WinFX.targets(470,9): error : <UICulture> 
should be set in the project file in order to support
the following markup files that use types defined in 
this project: E:\src\Lap\Messenger.xaml.

So what is this <UICulture> tag and how do I set it? The way we support locally defined types in compiled XAML is by building the assembly, then building the BAML files into a satellite assembly. But we need to know what culture to set for the satellite assembly, hence the need to add a new entry into the project file. Simply add the following element into your .csproj file and the application should build successfully:

<Project xmlns="...">
    <PropertyGroup>
        ...
        <UICulture>en-US</UICulture>
    </PropertyGroup>
    ...
</Project>

An alternative way to deal with this problem is to create the type in an external project and add a reference to it - this will enable everything to be embedded successfully without requiring a satellite assembly to be created.

Finally, I found with one of my projects that I also had to add the following to the Properties\AssemblyInfo.cs file - if you still have problems after editing the .csproj file, you might want to try this also:

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

Anyway, hope this helps someone. We're evaluating strategies for this moving forward, and it will probably all change again for the next release, but in the meantime, these are the two ways to go.

  • So I spent part of my weekend updating various applications to the most recent CTP. I figured I would...
  • So I spent part of my weekend updating various applications to the most recent CTP. I figured I would...
  • If you've frustratingly encountered the&amp;nbsp;&quot;&amp;lt;UICulture&amp;gt; should be set in the project file in...
Page 1 of 1 (3 items)