我需要 resx Designer.cs 文件吗?
我的公司使用一些数据库表、网页前端和“导出”应用程序的组合来处理网站中的字符串资源。
当我们使用 VS2008 时,导出应用程序工作得很好,但自从切换到 VS2010 后,资源现在在解决方案资源管理器中的“下面”有一个 Designer.cs 文件。
问题是“导出”应用程序仅生成 .resx 文件,而不生成底层的 Designer.cs 文件。
那么,有没有办法不拥有这些 Designer.cs 文件,或者有某种方法可以自动重新生成(或者甚至导出应用程序可以调用一些命令来重新生成它们)
My company uses a combination of some database tables, a web page front end and an "export" application to handle our string resources in our web sites.
The export application used to work just fine when we used VS2008, but since switching to VS2010 the resources now have a designer.cs file "beneath" them in the solution explorer.
The problem is that the "export" application only generates the .resx files and not the underlying designer.cs files.
So, is there a way to not have those designer.cs files, or alternatively some way to automatically re-generate (or even some command the export application could call to re-generate them)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我遇到了 VS 2010 无法重新生成 Designer.cs 文件的问题,并且在其他地方找不到解决方案。
不过,我能够重新生成它们,而无需进入命令行。
为了解决 Visual Studio 2010 中的问题,我执行了以下操作:
运行自定义工具
这会重建 Designer.cs 文件。
希望将来可以帮助别人。
I had a problem where VS 2010 would not regenerate the Designer.cs files, and couldn't find the solution elsewhere.
I was able to regenerate them though, without going to the command line.
To fix the issue in Visual Studio 2010 I did the following:
Run Custom Tool
That rebuilt the Designer.cs file.
Hope that might help someone else in the future..
从MSDN我们有:
将资源编译成程序集
From MSDN we have:
Compiling Resources into Assemblies
如果您希望在构建项目时从 *.resx 文件自动生成 *.designer.cs 文件,则以下方法对我们有用,也可能对您有用:
此解决方案基于项目文件的 ItemGroup 中列为“EmbeddedResource”的所有资源文件,例如
免责声明:这已使用 Visual Studio 2013 和 C# 项目进行了测试。它可能适用于其他项目和/或其他版本的 Visual Studio,也可能不适用于。
If you prefer to automatically generate the *.designer.cs files from *.resx files when building the project, the following approach worked for us and it might work for you as well:
This solution is based on all resource files being listed as "EmbeddedResource" within an ItemGroup of the project file, e.g.
Disclaimer: This has been tested with Visual Studio 2013 and C# projects. It may or may not work for other projects and/or other versions of Visual Studio.
试试这个:
保存并再次构建。
问题解决了。
Try this:
Save and build again.
Problem solved.
遵循这些步骤对我有用。
Following these steps worked for me.