I have a resource file strings.resx, and the generated resource class is in strings1.designer.cs. Why is this the case? The problem specifically is the "1". The class name inside that file is "strings", as it should be.
Note that I did try deleting the designer.cs and regenerating it by saving the resx file, but that didn't change anything.
Resource files (. resx) are only generated with source code when building a Project in Developer Studio.
A resource file is a text file with the extension . rc. The file can use single-byte, double-byte, or Unicode characters. The syntax and semantics for the RC preprocessor are similar to those of the Microsoft C/C++ compiler. However, RC supports a subset of the preprocessor directives, defines, and pragmas in a script.
Resources in . resx files. Unlike text files, which can only store string resources, XML resource (. resx) files can store strings, binary data such as images, icons, and audio clips, and programmatic objects.
I just ran into this problem and found the issue inside the .csproj file. It appears that Visual Studio saves the last filename it used and attempts to generate using that filename again. So if for some reason the Strings.designer.cs is ever generated as Strings1.designer.cs it looks like VS will continue to use Strings1.
Below you can see the portions of the .csproj file that was giving me an issue. Most importantly the <LastGenOutput>
at the end where Strings1.designer.cs is saved.
<Compile Include="App_GlobalResources\Strings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Strings.resx</DependentUpon>
</Compile>
<Compile Include="App_GlobalResources\Strings.es.designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Strings.es.resx</DependentUpon>
</Compile>
...
<ItemGroup>
<EmbeddedResource Include="App_GlobalResources\Strings.es.resx">
<Generator>GlobalResourceProxyGenerator</Generator>
<LastGenOutput>Strings.es.designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="App_GlobalResources\Strings.resx">
<Generator>GlobalResourceProxyGenerator</Generator>
<LastGenOutput>Strings1.designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
Changing the <LastGenOutput>
to the following solved my problem:
<LastGenOutput>Strings.designer.cs</LastGenOutput>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With