Reputation: 44312
Before modifying a resource file, it looks like this in VS.NET (2013):
Strings.resx
Strings.Designer.cs
After saving, it looks like this:
Strings.resx
Strings.Designer.cs
Strings1.Designer.cs
If I try to run the project, I get an error that Strings already exist. I have to then delete Strings.Designer.cs and rename Strings1.Designer.cs to Strings.Designer.cs.
Then I have to unload the project and modify those references in the project file XML. Then reload and all is well until I modify again.
Any idea how to fix this?
Upvotes: 1
Views: 781
Reputation: 1898
I found the answer from this link Generating *.Designer.cs from .resx.
Basically, you need to:
For example, I need to generate Strings.Designer.cs
:
<ItemGroup>
<Compile Update="App_GlobalResources\Strings.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Strings.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="App_GlobalResources\Strings.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
I hope this post can help someone in the future.
Cheers
Upvotes: 2
Reputation: 149
I faced the same issue. I deleted my old resource file and created a new resource file with same name and content. Now it is working fine.
So, delete the Strings.resx
file and create a new file with the same name that is Strings.resx
Upvotes: 2