Get the source code for the assembly

Is there a way to get the assembly location of the source code through reflection?

Warning . I am not looking for the current assembly location, and the place was the source code when it was compiled.

eg.

Given: myAssembly.dll
   c:\program files\myapp\myAssembly.dll <- I'm NOT looking for this location. This is its current location.
   d:\dev\myapp\main.cs <- this is the location I want; the location were the source code resided when it was compiled

I started with this, but so far I have not been able to find which rabbit hole to get in to get this information so far.

Assembly.GetExecutingAssembly().GetType("myAssembly.Main").<something>

If exceptions occur in .Net, you will often see the name of the class that selected the exception along with the full path to the source file. This is what I need. I understand that a .pdb symbol file may be required to get this location.

+4
source share
1 answer

.PDB. : , Debug, Release. .PDB . , .

Project + , "", "", " " . "" - Debug, "pdb-only" - Release, .

.PDB DbgHelp api, . DIA SDK COM- #. CLR , + .

+5

Source: https://habr.com/ru/post/1569784/


All Articles