Reputation: 61
Generated project view.dll)I have tried couple of products - dotPeek, JustDecompile and .Net Reflector, all of them are good at decompiling cs file from a dll. However, I am looking for one that can extract views (cshtml files) from a dll.
Is there any way, I could get views back? All I got is (view)dll.
Upvotes: 6
Views: 3000
Reputation: 31
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.
Upvotes: 3