Iso3166CountryCodes

Topics: Developer Forum
Sep 10, 2009 at 1:23 PM
Edited Sep 10, 2009 at 1:32 PM

Compilation error -"The name 'Properties' does not exist in the current context. - Iso3166CountryCodes.cs line 13

..............................

Is the Iso3166CountryCodes implementation documented in the book?

I see it referenced in /Models/ProfileInformation.cs on p.118.

............................

I have not created a default resource file in a web application before. I have tried the following:

- copied Iso3166CountryCodes.csv to \App_GlobalResources\.

- copied Iso3166CountryCodes.cs to \Models\.

- VS Solution Explorer | right-clicked web application | Properties | Resources Tab | Add Default Resource File | Add Existing File | \App_GlobalResources\Iso3166CountryCodes.csv.

............................

- When I try to open Iso3166CountryCodes.csv from within the Resources.resx design surface, I get the following:

"The Managed Resource Editor does not support the requested file type. Would you like to open the default editor for "xxx\IsoCountryCodes.csv"?

............................

 

Sep 15, 2009 at 12:43 PM
Edited Sep 15, 2009 at 12:49 PM

To begin with, I think the compilation error was due to the fact that my project's default namespace was "TbhMvc_ChapterByChapter" - I changed it to "TheBeerHouse".

I am curious why Iso3166CountryCodes.cs line 13: "Properties.Resources" resolves to "TheBeerhouse.Properties.Resources".

Is this because TheBeerHouse.Models.Iso3166CountryCodes class exists within the TheBeerHouse.Models namespace?

-.-.-.-.-

As a footnote for anyone unfamiliar with using Resouces.resx - The following are exerpts from my personal notes on adding Resouces.resx, Iso3166CountryCodes.csv and Iso3166CountryCodes.cs to the project:

-- p.118 missing section on creating \Properties\Resources.resx and \App_GlobalResources\Iso3166CountryCodes.csv:
  -- right click the project | Properties | Resources | Create Default Resource File
    -- change 1st dropDown to Files
    -- change second dropDown to Add Existing File
    -- browse to and select Iso3166CountryCodes.csv
      - this will copy Iso3166CountryCodes.csv into the \Resources folder (DevNote - the authors put Iso3166CountryCodes.csv into the \App_GlobalResources folder)

-- missing -- section on creating \Models\Iso3166CountryCodes.cs - see p.118
  - DevNote - \Models\Iso3166CountryCodes.cs references "Properties.Resources.Iso3166CountryCodes"
  - "Properties" exists within TheBeerHouse namespace
  - your project's default namespace is the same as your project's name - If this is not "TheBeerHouse":
    - change the default namespace for the project to TheBeerHouse:
       -- right click the project | Properties | Application | Default Namespace | "TheBeerHouse"
HTH