简体   繁体   English

反编译预编译的源代码ASP.NET

[英]Decompile Precompiled Source Code ASP.NET

we have an application in production and the code is in Pre-Compiled form. 我们在生产中有一个应用程序,并且代码为预编译形式。 The developer who developed that application left the company and we don't have any backup of source code. 开发该应用程序的开发人员离开了公司,我们没有源代码的任何备份。 the only access we have is Pre Compiled code in the server. 我们唯一的访问权限是服务器中的“预编译”代码。 We need to fix the issues in the application now. 我们现在需要修复应用程序中的问题。

Is there any way to Decompile (extract to actual source code) the PreCompiled code ? 有什么办法可以反编译(提取到实际的源代码)预编译的代码?

.NET Reflector中打开DLL。

To update @xOn's answer: 更新@xOn的答案:

Due to a recent source control disaster I had to recover my project from the DLLs. 由于最近的源代码管理灾难,我不得不从DLL中恢复我的项目。 So sadly I'm knowledgable on the procedure: 因此,可悲的是,我对该程序非常了解:

  1. Get .Net Reflector from here: http://www.red-gate.com/products/dotnet-development/reflector/ 从此处获取.Net Reflector: http//www.red-gate.com/products/dotnet-development/reflector/

  2. You do not seem to need FileDisassembler. 您似乎不需要FileDisassembler。

  3. Either load your bins in Reflector or double click them. 将您的垃圾箱加载到Reflector中或双击它们。

  4. Mind that the .Net framework might have not maintained your original project file structure. 请注意,.Net框架可能未维护您的原始项目文件结构。 So if some of your ASPX pages shared the same basic class name in different .cs files (IE Inherits tag is the same, but CodeFile tag differs), you would not be able to simply "export source code". 因此,如果您的某些ASPX页面在不同的.cs文件中共享相同的基本类名称(IE Inherits标记相同,但CodeFile标记不同),则您将无法简单地“导出源代码”。 Don't go blindly exporting source files. 不要盲目地导出源文件。 It won't work. 它不会工作。

  5. There will still be some work to be done before being able to just fire up the old build button. 在只启动旧的生成按钮之前,仍然需要完成一些工作。 For example - DLLs can refer to property's getter/setters directly. 例如-DLL可以直接引用属性的getter / setter。 You will have to fix that. 您将不得不解决该问题。

Good luck. 祝好运。

Start with: 从...开始:

http://www.red-gate.com/products/dotnet-development/reflector/ http://www.red-gate.com/products/dotnet-development/reflector/

...plus: ...加:

http://www.denisbauer.com/NETTools/FileDisassembler.aspx http://www.denisbauer.com/NETTools/FileDisassembler.aspx

You'll have to recompile the latter to link it against v6.5 of reflector (the latest, as of this post.) It is a good add-on if you want to avoid having to copy and paste ever single class into files by hand. 您必须重新编译后者,以将其与反射器的v6.5(最新的,截至本文)一起链接。如果您希望避免必须将单个类复制并粘贴到文件中,则它是一个很好的附加组件。手。 It will dump an entirely assembly as .cs files. 它将整个程序集转储为.cs文件。 I think it may even generate a csproj. 我认为它甚至可能会生成一个csproj。

Both tools are free. 两种工具都是免费的。

When u install .net reflecter.its import in visual studio. 当您安装.net Reflectioner.its时,将其导入Visual Studio。 then you saw the .net reflector tools on menu bar. 然后您在菜单栏上看到了.net反射器工具。

Click on .net reflector >>Choose Asseblies (Dll file) to debug. 单击.net反射器>>选择Asseblies(Dll文件)进行调试。

I found that dll can be just Read using the .NET Reflector tool but can't extract the Source Code. 我发现可以使用.NET Reflector工具读取dll,但不能提取源代码。 And also once the webforms are precompiled, we can't even get back the code behind files. 而且,一旦对Web表单进行了预编译,我们甚至无法获取文件背后的代码。 All we can do is to debug and analyze the Code. 我们所能做的就是调试和分析代码。

I had the similar issue and used Reflector to Decompile it. 我遇到了类似的问题,并使用Reflector对其进行了反编译。 I got the source code, then changed the bit I wanted, and rebuild it. 我得到了源代码,然后更改了所需的位,然后重新构建它。 Then I copied that dll again to Production site. 然后,我再次将该dll复制到生产站点。 It started to reflect my changes. 它开始反映出我的变化。 It was very easy and not at all difficult, maybe because Precompiled site had dlls for every page, and was updatable , so had only code-behind file in dll. 这非常容易,一点也不困难,也许是因为预编译站点的每个页面都有dll,并且是可更新的,因此dll中只有代码隐藏文件。

For reference: http://www.reflector.net/ 供参考: http : //www.reflector.net/

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

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