I realize my question may be something stupid. But here is the problem:
Ive got an ASP.NET MVC web application, it already compiled and it works on the web host. So it has no *.cs files (as I understand they turned into dlls), and clearly it has no *.sln file. I want to run this application using Visual Studio 17, and try to debug it(to see the real code working and get something useful for myself) is it possible? If yes, then please, tell me how to do this. I'd like to google it and find out, but I don`t even understand what to look for.
Thank you in advance.
You can to use Disassembler only for view a namespaces and clases, but not all the code.
Related
This question already has an answer here:
Is there a way to see decompiled C# code in VS Code?
(1 answer)
Closed 5 months ago.
Prerequisites:
I use Visual Studio Code Version: 1.63.2 (Universal)
MacOS Monterey 12.03 with M1
.NET version 6.0.302
Originally I am coming from Python, but lately, I interact with C#(in particular ASP.NET Core 6) a lot.
I have been trying to find an answer to a question:
How can I go to the implementation of the method/class in a dependency package installed in my .NET project? Is it possible to do it in VSCode?
Probably, I am just struggling with how should I formulate this question, so let me provide some examples below.
If I am using PyCharm and, let's say, have an installed package flask-login. I can import the function login_user as on the screenshot below.
Then just go to its implementation and see the whole code as on the screenshot below.
This happens because both in PyCharm and in VSCode it redirects me to the files stored in the bin directory of my interpreter path. As a result, I can always go locally and check the source code of all installed dependencies.
Now coming back to C#: I want to have the same thing in my .NET project with VSCode (I don't use Visual Studio and use MacOS). As for now in VSCode, I can only go to the interface code of a dependency and when I press go to implementation it says Implementation not found.
I am not sure whether this is possible or not, since C# is a compiled language, so probably it would require a decompiler for this to work. The only thing I managed to make work was the possibility to jump into implementation during debugging session https://github.com/OmniSharp/omnisharp-vscode/wiki/Debugging-into-the-.NET-Framework-itself. At the same time, this is slightly different from what I want -> I just want a convenient way to go into the implementation source code to understand what is happening in the code LOCALLY and probably set breakpoints in this code if I think it makes sense.
Therefore, my main question stays the same: Can I do it on MacOS in VSCode?
UPD: I tried Rider from JetBrains(https://www.jetbrains.com/rider) and it works there. Still interested in making this work in VSCode.
An answer is basically here -> Is there a way to see decompiled C# code in VS Code?
There is a feature to enable decompilation in omnisharp extension for C# in VSCode.
Thanks to #UnholySheep!
When I want to read the source code of .net core, I click Go to Declaration button and on the Windows edition, I get the decompile code by the local .dll file.
But when I do the same behavior on the rider for macOS edition, Looks like I get the real source code from Internet and this edition can get comment that very useful for me.
So I wonder know how to change the default behavior for Windows edition to get real source code? I am searching for a long time on net. But no use. Please help or try to give some ideas how to achieve this.
Thanks in advance.
I've published my ASP.NET website to my Windows Server 2012 via Visual Studio.
But things happened, and I lost all of my sources. I had a backup but it is not recent enough. I could re-code everything that is missing but I don't remember all of it.
I was wondering if it's possible to get the source code from the server where I published my website ? I have a full access on it.
Thanks,
Hellcat8
Sorry to hear that!
An ASP.NET (WebForms) application consists of code-behind classes and .aspx pages. All the code-behind classes are compiled into a class library located in the bin folder in the root directory.
An ASP.NET (MVC) application has a similar structure, but with views instead with the .cshtml / .vbhtml extension(s).
If you've lost the back-end code for the application, you'll need to decompile the dll file to obtain your code back. Sadly, you'll lose all of the code comments so they'll need to be re-created.
Some decompilers: dotPeek, ILSpy, JustDecompile, Reflector
I think that if you don't have a Repository or something similar but ONLY DLL's you can try with a Reverse enginnering tools...like:
http://www.red-gate.com/products/dotnet-development/reflector/
I have an application I made that I lost the source code for, but the application has worked on my Win 2K computer. Now when moving to a Windows 7 computer it won't start. Probably some dependencies that needs to be solved, but I don't know which. The only error I got is a System.InvalidOperation without further description
Is there any tools(free) that I can use to get more specific information on what goes on
I am not sure how/if you can debug the application, but here is another idea.
There are tool out there called "reflectors", which allow you to look inside the .NET dll or executable.
They basically do the reverse of the compiler convert the dll/exe to source code (Now it won't be exactly the code you wrote, for example some local variables might have changed their names and some things might have been optimized, but the end result is the same, since this reflected code came from the same dll/exe.)
Now you can take the output of this and use it to rebuild and then debug your application.
Here are some ofthese tool:
dotPeek - free
.NET Reflector - not free
I know dotPeek doesn't allow you to debug inside of it, so you have to rebuild your application. The other one seems to be able to do that with its most expensive licence. Good luck!
You can also use Microsoft Debugging Tools for Windows (WinDbg). Here is an article that can help you.
http://www.dependencywalker.com/ will tell you dependencies and missing ones.
Also, you can attach visual studio, or get visual studio to launch a exe in debug mode without the source code.
my first try would be dependency walker just to make sure your not
missing some piece of native code
then I would look to just attempting to attach the program to visual
studio.
My next step would be to use something like reflector to get some
version of source code.
The pro version of regate's reflector let's you debug an existing dll without the sourcecode, costs $ 138 tho.
Ilspy will let you see the source for free, maybe you can figure it out from that.
Rgds Gert-JAn
I'm going to ask a newbie question here. I need to use a control I found online in my code, but it was written in the wrong language. It is in C# and I am using VB.net for work. I have all of the code for the control which works beautifully in C#, but I had issues with it not working very well in VB.
The source code and a demo project are available here, but I am not sure exactly which files I should use to build the dll for VB.
It seems a lot to ask, but would someone mind taking a look and pointing me in the right direction?
Cheers
Add the project to your solution, or just build it using your version of Visual Studio. Then add a reference, either to the project in the first case, or the .dll in the second.
If the Control doesn't work well, it's not because it's written in C# as opposed to VB.Net.
You should be able to use/reference the DLL as-is from your visual basic solution. It doesn't matter whether it was written in C#, VB.NET or any other .net language.
One you compile a dll from the c# source it will work exactly the same as if it were written in vb. You simply need to create a reference to the dll in visual studio.