Click here to Skip to main content
16,018,904 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I have been experiencing a problem whereby every time i add a resource and then build my project a new resource file is added called Resources1.Designer.cs when a resource file already exists.

Does anyone know why this might be?

Thanks George
Posted
Comments
amura.cxg 18-Jul-11 16:23pm    
In the "Solution Explorer" under "Properties" what is the name of the .resx file?
grwithey 19-Jul-11 2:32am    
It is "Resources.resx" however the file that is duplicating is "Resources.Designer.cs" as it creates "Resources1.Designer.cs" when the project is built when a new resource is added.

Have you tried below:
1)undoing the changes by undoing checkout (if using TFS),
2)clean the solution,
3)Restart Visual Studio
4)Retry adding resource and rebuild
 
Share this answer
 
Comments
grwithey 19-Jul-11 5:54am    
Just tried this and it still added Resources1.Designer.cs
Open csproj file of your project

Find the below tags:-
<EmbeddedResource Include="Resources\Resources.resx"> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources1.Designer.cs</LastGenOutput>
</EmbeddedResource>

Then change it to below:-

<EmbeddedResource Include="Resources\Resources.resx"> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>

Hope this helps you. :)
 
Share this answer
 
Comments
grwithey 19-Jul-11 7:50am    
Thank you for this prachi i can now add a new resource and this problem does not occur. I don't know how it got to be "Resources1" in the first place but this fix worked.

Thanks George =)
prachi sahai 19-Jul-11 7:54am    
You are welcome :)
krupit 6-Jul-17 4:59am    
Thank you so much prachi.
It's also helpful for me
nirman b doshi 18-Jul-18 2:42am    
Excellent. This is the solution in one of our legacy project!
SQL
In my case, just Rename your resource file with a name start with Resource then Resource.designer.cs will auto generate.

Ex:
Resource.Homepage.resx
Resource.vi.resx
Resource.en.resx
 
Share this answer
 
Try opening the 'Resources.Designer.cs', as in view the generated code - I'm fairly certain you'll find a new way to access the resources :)

Best regards
Espen Harlinn
 
Share this answer
 
Comments
grwithey 19-Jul-11 6:06am    
Thanks for this although not sure if i understand entirely, i might be missing the hint but why would i need a new way of accessing resources?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900