Alex Rivera | Logout

Browsing the .NET Framework source code from Visual Studio

Asked 2012-03-14T03:37:50.010
63

I know that I can set up Visual Studio to debug through the .NET framework source code.

But is there a way that I can browse the code while NOT debugging - i.e., being able to press F12 or "Go to definition"?

I thought that if that feature isn't built into Visual Studio then there may be a plug-in that might add it?

Edit
Report

2 Answers

6

I downloaded the .NET Framework source code from here http://referencesource.microsoft.com/netframework.aspx.

Since I am working with .NET 4.0, I chose ".Net/4" from the list. (What is ".NET/8.0" in that list? No idea.)

I wrote some scripts to rearrange the bloody mess they give us:

  • Into a reasonable hierarchy of directories;
  • To remove duplicated code (why is every file doubled, or was my install bad?);
  • Rename all top-level namespaces to not conflict with native ones baked into Intellisense.
  • Example: System.Windows.Controls -> xSystem.Windows.Controls

Then follow these steps:

  1. Create a new Visual Studio project of type "Class Library"
  2. Remove all references -- yes, even the system ones.
  3. Drag/drop all of your massaged .NET code into the root of your project.
  4. Wait about 30 minutes for VS processing. VS will appear to freeze; be patient.

Intellisense/ReSharper still complains about heaps of problems, but now I can right click and select "Go to Declaration/Implementation".

Visual Studio is about 600MB with this project loaded.

answered 2012-10-08T11:49:36.487
0

There is the .NET Mass Downloader, but I think the straightforward answer to your question is, no.

However I now see Microsoft has made the code more easily downloadable.

Nevertheless note that even for your own code, when not debugging, unless you have the project open, VS does not help you locate source code (even though when you find it yourself break points will work when you start debugging again, if the .pdb files correspond).

answered 2012-05-21T16:19:31.523

Your Answer