views:

285

answers:

2

My C# project references a third-party DLL for which I have the source code. Can I somehow tell Visual Studio the location of that source code, so that, for example, when I press F12 to open the definition of a method in the DLL, it will open up the source code, instead of opening up the "Class [from metadata]" stub code?

A: 

One way you could do this would be to create another project in your solution, put the DLL source in there, and then from your main project, add the dependency as a project reference instead of an assembly reference. That should let you browse the source / step into it while debugging, etc.

There might be an easier way to do it, but I'm not aware of any at present.

tzaman
It clutters the solution a bit, and it means I am compiling the third-party DLLs myself, which feels a little strange/slower. I was hoping Visual Studio had the equivalent to Eclipse's "attach source" option when referencing a JAR file.
Joe Daley
Yeah, I know it's less than ideal. If someone else has a better solution, I'd be interested to know myself.
tzaman
A: 

If you use Resharper you can enable it by going to Resharper / Options / External Sources, and move up "Sources from symbol files". Then in the tab "Sources from symbol files" click "Advanced" and there you can map source folders.

Cesar Reyes