Murilo
Murilo

Reputation: 1152

Ambiguity Error after changing Resource File

I have an ASP.NET application that is available in two languages: English by default and Portuguese as second option.

Everything was working good, look this first image:

explorer before changing resource file

Then when I try to add or remove a string resource, visual studio starts to give me ambiguity errors when compiling, as those:

The namespace 'VolunteerGames.Web.Translations' already contains a definition for 'Translation'

and

Ambiguity between 'VolunteerGames.Web.Translations.Translation.ResourceManager' and 'VolunteerGames.Web.Translations.Translation.ResourceManager'

I noticed that after changing the resource in designer (Translation.resx) a new file named Translation1.Designer.cs was created. It created another class called Translation. If I delete this new file I can compile, but the new strings I just created are not found when I try to use on my controller.

enter image description here

I can't understand what's going on. I've been working for months in this project and it was all good.

Upvotes: 4

Views: 6197

Answers (2)

Vincent
Vincent

Reputation: 103

For late-comer who encountered with the same problem

It looks like the project was created in ResX Schema older version (v1.3) but reopen(and save) in ResX schema v2.0, since the Schemea is auto created, the VS will do so because schema standard is different is not adaptable. We can have two files with completely same name in one directory, it attached a number with its original name

Upvotes: 0

Murilo
Murilo

Reputation: 1152

Because Visual Studio started to create the file Translation1.Designer.cs, and that new file conflicted with Translation.Designer.cs, and when I tried to delete it I got erros, then I deleted Translation.Designer.cs so everything is working now again.

enter image description here

Upvotes: 15

Related Questions