开发者

ReSharper - Duplicate Resource (resx file)

开发者 https://www.devze.com 2023-01-24 03:52 出处:网络
After running ReSharper on our project we receive the following error m开发者_开发问答ultiple times in various resx files;

After running ReSharper on our project we receive the following error m开发者_开发问答ultiple times in various resx files;

"Duplicate Resource"

Is there a way we can easily clean each forms resx file. For example, is there a way we can safely regenerate the resx file within VS2010?

This is a C# project.


I'm the author of a commercial localization product (see http://www.hexadigm.com). If your ".resx" files are code-behind files for a windows form or user control (created and managed by the VS forms designer), then you can normally fix the problem by setting the form's "Localizable" property to false and then immediately back to true again (in the VS forms designer). That will regenerate the ".resx" file and normally eliminate any duplicates (backup your files first however, just in case). For other ".resx" files however (non-code-behind files you manage yourself), I'm not aware of any tool that will fix this for you. Note that my own product however will trap this problem (and others) but doesn't fix it. It's too risky IMO. If you have a duplicate resource that is, then the entire ".resx" file is suspect so attempting to automate a fix could make things worse (since the file could potentially have more serious problems than just duplicates). In reality it normally is just a case of duplicates (nothing more serious) but IMO it's safer for the programmer to diagnose the situation so my app will report each duplicate and then abandon processing of the affected ".resx" file (which I report to the user accordingly, as well as record to the VS Output window).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号