Fork based on KirillOsenkov/SourceBrowser, we are extending and bending SourceBrowser to satisfied our needs and to support our specific Solution structures.
Source browser website generator that powers https://referencesource.microsoft.com, http://source.roslyn.io, https://source.dot.net, and https://aspnetsource.azurewebsites.net/ (unofficial ASP.NET Core 1.0 source).
Create and host your own static HTML website to browse your C#/VB/MSBuild/TypeScript source code. Note that it does require an ASP.NET Core website for hosting (symbol index is kept server-side), so without ASP.NET Core the search function doesn't work.
- Support for excluded projects. Can be defined as list.
- Support for federation server list.
- The server indexing core part has been extracted to separated project for external use.
- Two new NuGet packages
- Enhanced.SourceBrowser.Common
- Enhanced.SourceBrowser.SourceIndexServer.Core
- /out:[outputDirectoryPath] - Path to output directory, where the static HTML sides will be created, even with ASP.NET core website files. By default Index folder in current working directory will be used.
- /in:[filePath] - Text file as a list of input file paths to solutions/projects to generate from. One path per line.
- /exclude:[filePath] - Text file as a list of excluded solutions/projects which will be skipped during generation. Project file names with extension. One project file name per line.
- /federation:[serverUrl] - Specify URL to a new federation server.
- /offlinefederation:[serverUrl]=[offlineAssemblyListFilePath] - Specify a new federation server as a offline assembly list.
- /fedlist:[filePath] - Text file as a list of federation servers. Supported are URLs and offline definitions in format: offline:[serverUrl]=[offlineAssemblyListFilePath]. One URL or offline definition per line.
- /p:[name]=[value] - Set a property for MsBuildWorkspace.
- /plist:[filePath] - Text file as a list of properties for MsBuildWorkspace. One property per line in format: [propertyName]=[propertyValue]. Not implemented yet.
- /force - Override a content of output directory without asking.
- /noplugins - Disable all MEF plugins.
- /noplugin:[pluginName] - Disable a specific plugin.
- /nobuiltinfederations - Disable built in federation servers.
- /assemblylist - Trigger generation of assembly list to initial left panel.
- Any extra argument - will be processed as a input solution/project to generate from. Format: [pathToSolution.csproj|vbproj|sln] [more solutions/projects..].
- git clone https://github.com/KirillOsenkov/SourceBrowser.git
- cd SourceBrowser
- dotnet restore
- msbuild
- cd bin\Debug\HtmlGenerator
- HtmlGenerator.exe ..\..\..\TestCode\TestSolution.sln
- the website in bin\Debug\HtmlGenerator\Index is ready to be served
- Open SourceBrowser.sln.
- Set HtmlGenerator project as startup and hit F5 - it is preconfigured to generate a website for TestCode\TestSolution.sln (you may need to unload the SourceIndexServer project if you see an error message that IIS can't serve from bin\Debug\HtmlGenerator\Index).
- Pass a path to an .sln file or a .csproj file (or multiple paths separated by spaces) to create an index for them
- Pass /out: to HtmlGenerator.exe to configure where to generate the website to. This path will be used in step 6 as your "physicalPath".
- Pass /in: to pass a file with a list of full paths to projects and solutions to include in the index
- Set SourceIndexServer project as startup and run/debug the website. It is pre-configured to run from \bin\Debug\HtmlGenerator\Index but you can customize in project properties -> Web -> Custom server.
Note: Visual Studio 2017 is required to build Source Browser.
At indexing time, C# and VB source code is analyzed using Roslyn and a lot of static hyperlinked HTML files are generated into the output directory. There is no database. The website is mostly static HTML where all the links, source code coloring etc. are precalculated at indexing time. All the hyperlinks are hardwired to be simple links bypassing the server.
The only component that runs on the webserver is a service that given a search query does the lookup and returns a list of matching types and members, which are hyperlinks into the static HTML. The webservice keeps a list of all declared types and members in memory, this list is also precalculated at indexing time. All services, such as Find All References, Project Explorer, etc. are all pre-rendered.
The generator is not incremental. You have to generate into an empty folder from scratch every time, and then replace the currently deployed folder with the new contents atomically (using e.g. Azure Deployments, robocopy /MIR to inetpub\wwwroot, etc). For smaller projects, deploying to Azure using Dropbox or Git would work just fine.
- Indexing more than one project with the same assembly name is currently unsupported. Only the first project wins. This is due to a fundamental design decision to only reference an assembly by short name. Customizers should add a means to filter "victim" projects out in their forks to pick the best single project for inclusion in the index.
- The generated website can only be hosted in the root of the domain. Making it run from a subdirectory is non-trivial and unlikely to be supported.
- Solution Explorer - contents of projects merged into single tree on the left
- coloring for C#, VB, MSBuild, XAML and TypeScript
- Go To Definition (click on a reference)
- Find All Reference (click on a definition)
- Project Explorer - in any document click on the Project link at the bottom
- Namespace explorer - for a project view all types and members nested in namespace hierarchy
- Document Outline - for a document click on the button in top right to display types and members in the current file
- http://<URL>/i.txt for the entire solution and /AssemblyName/i.txt (for an assembly) displays source code stats, lines of code, etc
- http://<URL>/#EmptyArrayAllocation finds all allocations of empty arrays (this feature is one-off and hardcoded and not extensible)
- Clicking on the partial keyword will display a list of all files where this type is declared
- MSBuild files (.csproj etc) have hyperlinks
- TypeScript files (*.ts) are indexed if they're part of a C# project. Work underway to allow an arbitrary array of TypeScript files.
- Search for GUIDs in C#/VB string literals is supported
Fork based on KirillOsenkov/SourceBrowser, we are extending and bending SourceBrowser to satisfied our needs and to support our specific Solution structures.