Browsing the .NET Framework source code from Visual Studio

前端 未结 7 1545
情书的邮戳
情书的邮戳 2020-12-05 01:42

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., bei

7条回答
  •  情歌与酒
    2020-12-05 02:39

    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.

提交回复
热议问题