简体   繁体   English

恢复被生成的代码覆盖的文件

[英]Recover files overwritten by generated code

I have a Winforms project that had a amongst others, 7 forms that I blindly named them with the same name that I named tables in my SQL server. 我有一个Winforms项目,其中除其他外,还有7个表单,它们以与我在SQL Server中命名表的相同名称盲目地命名它们。 Now I was trying to experiment with Entity Frameworks Data Model and visual studio generated classes for the tables in Database. 现在,我正在尝试使用实体框架数据模型和Visual Studio为数据库中的表生成类。 For these 7 forms that class names were identical visual studio deleted all the code that I had in the forms. 对于这七个类名称相同的表单,Visual Studio删除了我在表单中拥有的所有代码。 Is there any way to recover my old code. 有什么办法可以恢复我的旧代码。 I have no usable backup! 我没有可用的备份!

I am sorry to say, but unless you have any backup there is no way to recover that files directly. 不好意思,但是除非您有任何备份,否则无法直接恢复该文件。

You could use ILSpy (or one of the other options in this blog article ) to disassemble the assembly you have once compiled. 您可以使用ILSpy (或此博客文章中的其他选项之一)来反汇编曾经编译过的程序集。 You will have at least something like what you had. 您至少会拥有和以前一样的东西。 (You will lose comments and other stuff) (您将丢失评论和其他内容)

Maybe slightly off-topic, but when you are lucky, you might find your files back with some disk recovery tools like GetDataBack from the company Runtime. 也许有些偏离主题,但是幸运的话,您可能会使用公司运行时的一些磁盘恢复工具(如GetDataBack)找到文件。 I use it a lot myself. 我自己经常使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM