Search code examples
asp.net-coreasp.net-core-mvcwebdeploy

How to revert to code from publish file ASP.NET Core MVC


I published an ASP.NET Core MVC app to hosting four months ago. Now, I need to make some changes, but I've lost my source code, and the Git version is too old. However, I do have access to the last published files. Is it possible to revert my code from the published files?

I searched everywhere but couldn't find any useful information.


Solution

  • I suggest you could try with ILSpy, you could download it from this github link.

    Then you could install it.

    You could follow below steps to open then dll and then select all and generate the code.

    1.Open ILSpy, and clear out the Assemblies window (Ctrl-A, delete) 2.Select the .dlls containing your source code 3.Drag them into ILSpy’s Assemblies window 4.Select all of the Assemblies in ILSpy (Ctrl-A) 5.File -> Save Code.

    Like below, it will generate the csporj file.

    enter image description here