Problem in Visual Studio 2010, changing resources sets the constructor to internal

I am experiencing some strange behavior in Visual Studio 2010 when developing Silverlight applications and using project resources (.resx)

Each time I change a resource, it is configured for internal, and not public in the code behind, although I can see it in design mode, as is customary in public, it is not.

Any idea how to fix this?

I don’t know if this affects only Silverlight projects or all C # projects in general.

+3
source share
5 answers

pre-build, "internal" "public" .Designer.cs. , pre-build.

, (, REPLACE.EXE) :

c:\utility\replace\replace.exe "$ (ProjectDir)\LocalizedStrings.Designer.cs" "internal" "public"

$(ProjectDir) - VS, .

.

+2

- , .cs, , , . , , - Guy Smith-Ferrier. , "Custom Tool" .resx "PublicResourceCodeGenerator".

+1

:

public class TextRes2 : TextRes
{
  public TextRes2() { }
}

<ResourceDictionary>
  <!--res:TextRes x:Key="Strings" /-->
  <res:TextRes2 x:Key="Strings" />
</ResourceDictionary>
+1

- .

All our resource files are modified by a third-party software tool that updates resource files in accordance with changes made to user interfaces. All he does is update the lines in xml. we still have to go into VS and switch the access modifier from Public to something else and go back to Public, so VS will synchronize the code to match the new string values. Then we need to update C #, changing the internal to public.

So, for us, we need both stages automated, the rearrangement of the code behind and the internal fixation.

0
source

Source: https://habr.com/ru/post/1786850/


All Articles