简体   繁体   中英

How to decompile/extract(cshtml--(razor view)) from dll

Generated project view.dll) I have tried couple of products - dotPeek, JustDecompile and .Net Reflector, all of them are good at decompiliing cs file from dll. However, i am looking for one that can extract views (cshtml files) from dll.

Is there any way, i could get views back, all i got is (view)dll.

Thanks

It happened to me yesterday, here's what I did:

Decompiled my .Views.dll with ILSpy - used "Save code..." on Views_Home_index and got AspNetCore.Views_Home_Index.cs file.

Opened file in text editor and started at public override async Task ExecuteAsync() method - there's a bunch of WriteLiteral() and __tagHelperExecutionContext.AddHtmlAttribute() methods made based on your .cshtml file and it looks horrible, but finally are quite easy to "decompile". Mainly you just copy all contents from WriteLiteral() and replace .AddHtmlAttribute() with attributes defined at the top of the file.

My view was quite small, had mainly html/js in it so it didn't took long.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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