Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CultureAndRegionInfoBuilder doesn't exist

Okay, this is a strange one.

I'm trying to create a custom culture using:

using System.Globalization;

...

var x = new CultureAndRegionInfoBuilder();

But I get the nasty red Resharper error with no options.

The type or namespace name 'CultureAndRegionInfoBuilder' does not exist in the namespace 'System.Globalization'

What's going on, am I missing something? Can't find any help on google...

like image 602
Chris Haines Avatar asked Jan 18 '10 18:01

Chris Haines


3 Answers

You need to add a reference to sysglobl.dll. This is already installed in the GAC as sysglobl.

For future reference, if you check the MSDN page for CultureAndRegionInfo you can see that it says

Namespace: System.Globalization

Assembly: sysglobl (in sysglobl.dll)

The issue is that namespaces can be spread across different assemblies (for example, System.Globalization.CultureInfo lives in mscorlib.)

like image 159
jason Avatar answered Sep 28 '22 19:09

jason


Jason is correct.

To add the sysglobl.dll reference:

  1. In Solution Explorer, right click on your project's References
  2. Click Add Reference...
  3. Type sysglobl in the search box in the upper right-hand corner
  4. Check the box
  5. Click OK
like image 32
JDawg Avatar answered Sep 28 '22 21:09

JDawg


Just to add to Jason's answer, if like me you're working with a web site, and not a web project, just add to your web.config, under the the tags system.web => compilation => assemblies:

<add assembly="sysglobl, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
like image 40
Johann Avatar answered Sep 28 '22 19:09

Johann