Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

resx resource file shows warning "The resource name is not a valid identifier"

Background

  • I began converting strings to resources for within application.
  • They all worked fine.
  • My PC restarted itself without warning (power issue).

Problem

  • Four resources within my RESX file trigger a warning along the lines of:

    The resource name '[name]' is not a valid identifier.

Where [name] is the name of the resource.

Screen capture

enter image description here

I can't find what I'm doing wrong, and I can't determine whether this is related to my other power failure issue.

I know resource names shouldn't contain spaces or periods, but I've checked mine and I don't think they do (PS I know the names could be much better, and do plan to reviswit it).

like image 850
SeanKilleen Avatar asked Dec 21 '22 00:12

SeanKilleen


2 Answers

Actually in the Resx designer, if you change the "Access Modifier" dropdown, to "No code generation", the designer.cs and the warning "The resource name '[name]' is not a valid identifier." go away.

Unless the designer cs is necessary for you to have, you can try this approach as well.

like image 92
Vin Avatar answered Apr 19 '23 22:04

Vin


You cannot start your resource name with a number.

like image 42
Remy Avatar answered Apr 19 '23 23:04

Remy