Blue Theme Orange Theme Green Theme Red Theme
 
ASP.Net 4 Hosting is here
Home | Forums | Videos | Photos | Blogs | Beginners
 | Consulting  
Submit an Article Submit a Blog 
 Jump to
Skip Navigation Links
TechnologyExpand Technology
WebsiteExpand Website
 Resources  
Close
 Our Network  
Close
Search :       Advanced Search »
Home » VB.NET » NetMassDownloader

NetMassDownloader


With this tool you can download whole .Net Framework Source Code at once, and enjoy offline browsing With it , you can have whole the source code without any Visual Studio Product Installed.

Total page views :  1676
Total downloads : 
   Print Read/Post comments Post a comment  Similar Articles  
   Email to a friend  Bookmark  Author's other articles  
 
Become a Sponsor

Welcome to the .NET Mass Downloader project. While it's great that Microsoft has released the .NET Reference Source Code, you can only get it one file at a time while you're debugging. If you'd like to batch download it for reading or to populate the cache, you'd have to write a program that instantiated and called each method in the Framework Class Library. Fortunately, .NET Mass Downloader comes to the rescue!

The tool which enables offline debugging in VS2008 , VS2008 Express Edition ,VS2005 And Codegear Rad Studio. Only thing you need to use this tools is having .Net Framework 3.5 RTM Installed. With it , you can have whole the source code without any Visual Studio Product Installed.

Background

As you all know the .Net Framework 3.5 Source Code has been made public via Visual Studio 2008 with the install of a small addin a few weeks ago.The actual short coming of the tool was, that it didn't support the download of the whole framework code at once, nor it has been downloading each source file for a class one by one. Also because of each time downloads it was not possible to use this feature offline , so no offline debugging was possible.

It was also not possible to use this nice feature in VS2005 and VS2008 Express Editions. Our tool enables you to use whole this missing features.

Some small note from John Robbins Blog About Our Project:

Kerem Kusmezer contacted me and said that he'd been hacking around with Fiddler and figured out how to download the PDBs and code from Microsoft. He asked if I I'd be interested in helping him develop the utility and I don't think I ever wrote a response faster in my life! Kerem had already started a discussion with Shawn Burke about the legality of producing a source downloader and once we got back a very encouraging "go for it" we got to work. All the credit for the tool belongs to Kerem Kusmezer. He did all the really hard work of figuring out the HTTP downloads ,the PE file processing, and PDB Stream Extraction.

I did the console driver, a lot of testing, and sat around amazed at how much work Kerem could accomplish in very short periods of time. I really appreciate that Kerem let me work on the project with him and being his code monkey.

Prerequisites:

When you first run Net Mass Downloader, you will be prompted with the current EULA for accessing the source code. If you don't agree with the Microsoft EULA, clicking the Decline button will not download the source code.

You must install the RTM Version of the .NET Framework 3.5 to access the source codes even if you are using VS2005.

Using the code

The tools has been implemented as a commandline application , which shows the following help screen after you execute it.



The only required arguments are -file or -directory, both of which can be specified as many times as you'd like. When you specify a directory, only the .DLL and .EXE files from that directory will be processed. If you wanted to download all the source code from binaries in the .NET 2.0 32-bit and 64-bit directories, the command line you'd pass is: -d C:\Windows\Microsoft.NET\Framework\v2.0.50727 -d C:\Windows\Microsoft.NET\Framework64\v2.0.50727.

The main purpose of Net Mass Downloader is to populate the source code download cache for debugging, the default download location is the cache you specified to Visual Studio 2008. We put in the -vsver switch to account for future Visual Studio versions so Mass Downloader could work with future CTPs and versions.While it's great to see the .NET Reference Source Code in Visual Studio 2008, there are a lot of developers out there who can't upgrade yet.

VS2005 Setup For NetMassDownloader

Initially, we went down the path of seeing if we could patch the PDB files so Visual Studio 2005 users could have access to the .NET Reference Source Code. After a lot of hassle, we realized that there was a much easier way. If you specify the -output switch, we will put the PDB and the source code into that directory using the build paths instead of the source server paths. Thus, if your command line to NetMassDownloader.exe is -d C:\Windows\Microsoft.NET\Framework\v2.0.50727 -output c:\ReferenceSource, the PDB files are put in C:\ReferenceSource as well as the source files.

To use the .NET Reference Source with Visual Studio 2005, you would need to do the following three additional steps. The first is in the Options dialog for Visual Studio, Debugging, Symbols property page. In the "Symbol file (.pdb) locations" list box, you would add "c:\ReferenceSource" like the following:

The second setting is in Options dialog, Debugging, General property page, uncheck Require source files to exactly match the original version.

The final step you'll have to do in each solution where you want to access the downloaded .NET Reference Source Code, you'll go into the solution property pages, Common Properties, Debugging Source Files, and add C:\ReferenceSources to the top of the "Directories containing source code" list box as follows:

Visual Studio 2005 will automatically do the right thing and replace the first directory of every source file it finds in a PDB file with c:\ReferenceSource. With the automation model in Visual Studio 2005, I'm sure you could wipe up a macro to automatically set that path in the solution.

VS2008 Express Edition Setup

Initially, we went down the path of seeing if we could patch the PDB files so Visual Studio 2005 users could have access to the .NET Reference Source Code. After a lot of hassle, we realized that there was a much easier way. If you specify the -output switch, we will put the PDB and the source code into that directory using the build paths instead of the source server paths. Thus, if your command line to NetMassDownloader.exe is -d C:\Windows\Microsoft.NET\Framework\v2.0.50727 -output c:\ReferenceSource, the PDB files are put in C:\ReferenceSource as well as the source files.

To use the .NET Reference Source with Visual Studio 2008 Express Edition, you would need to do the following three additional steps. The first is in the Options dialog for Visual Studio, Debugging, Symbols property page. In the "Symbol file (.pdb) locations" list box, you would add "c:\ReferenceSource" like the following:



First be sure that "Require source files to exactly match the original version" is not checked in VS2008 Options -> Debugging -> General Dialog.

After that check the checkbox Show all settings which is at the left down of the screen. If show all settings has been checked, the screen will look like the following:

There please goto the Symbols location , add the target path that you give out in the -output directory there. For example we assume you used the following commandline arguments to execute NetMassDownloader
netmassdownloader.exe -d c:\winnt\microsoft.net\framework\v2.0.50727 -output c:\cachetest -v

You will see a similar window like this:

Just write the output directory c:\cachetest as above to the symbols dialog. Only one step is left after that, you can enjoy debugging the .net framework under VS2008 Express Edition. Just open a new solution in VS2008 Express Edition, goto the Solution Properties Dialog, add the above mentioned directory to it like below:

Now you can debug with F11 into the sourcecode of .net framework offline from your VS2008 Express Edition.

Additional Notes

When you first run Net Mass Downloader, you will be prompted with the current EULA for accessing the source code. If you don't agree with the Microsoft EULA, clicking the Decline button will not download the source code. While you might be tempted to remove the EULA check, I would strongly recommend that you not do so as Microsoft has said that they may change the EULA at any time. The last thing you want to do is get caught with a license change that could impact your life.

One group we need to thank is the Developer Division at Microsoft. First they released the .NET Reference Source Code, and second for allowing a couple of developers to have some fun and provide a utility for the community. As always let us know on CodePlex if you encounter any bugs or have feature requests.

Points of Interest

Things i have learn during the course of the implementation are as following:

  • Decomposition and parsing of a pdb file. Actually I ported a pdb parser to c# for this reason.

  • Decomposition and parsing of a pe file, finding the required debug information sections in it.

  • A srcsrv file parser , which also parses srcsrv macros included in the srcsrv files.

  • A customer webclient class, which helps with eula downloads.

Project Structure

The solution consist of 2 projects :
DownloadLibrary and NetMassDownloader Console Application.

When we break down each component of the DownloadLibrary Class Library, they are the following:

  • DownloadLibrary.PEParsing.PEFile The class which is responsible for PE Header and Debug Directory Parsing and detection , also responsible for PDB Download and Url Creation. Uses the IMAGE_DOS_HEADER, PESectionHeader,CV_INFO_PDB70,  _IMAGE_DEBUG_DIRECTORY, IMAGE_DATA_DIRECTORY, IMAGE_FILE_HEADER,  IMAGE_NT_HEADERS32, IMAGE_NT_HEADER64 , IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64 Structures. Age, Guid , Version of the target PDB File is found out using this structures.

  • DownloadLibrary.Classes.PdbParser The class is responsible for PDB Parsing. It is actually part of a different project also written by me. PdbParser For C#, which will be released in a few weeks. It supports parsing and stream decomposition of a PDB70 Version PDB File. It extracts whole streams, parses the PDB Header etc. This is required to parse out the SRCSRV file , which holds the url locations of each source code file.

  • DownloadLibrary.Classes.PdbExtractor This class is responsible for creating SrvSrcFile from the provided PdbFile, also responsible for downloading each source file from the Microsoft Reference Server and putting them in correct directories. It uses the PDBWebclient, PdbParser , ScrSrvFile classes for that purpose.

  • DownloadLibrary.Classes.SrcSrvDownloadableFile,SrcSrvFile These classes are responsible for SrcSrv files parsing , target url generation and target path generation.

  • DownloadLibrary.Classes.Eula.PDBWebclient This is a class which is derived from System.Net.WebClient which is responsible for downloading the contents from Microsoft Reference Server, Handling and Storing Of Eula Response And Eula Detection.

History

v1.1 A Bugfix Release Has Been Released Which Solves A Bug With Some Proxies Not Returning The Correct Headers.

Download NetMassDownloader From Here For Free(http://www.codeplex.com/netmassdownloader)

You can download also the source code from the project page.


Login to add your contents and source code to this article
 About the author
 
Kerems Kusmezer
Looking for C# Consulting?
C# Consulting is founded in 2002 by the founders of C# Corner. Unlike a traditional consulting company, our consultants are well-known experts in .NET and many of them are MVPs, authors, and trainers. We specialize in Microsoft .NET development and utilize Agile Development and Extreme Programming practices to provide fast pace quick turnaround results. Our software development model is a mix of Agile Development, traditional SDLC, and Waterfall models.
Click here to learn more about C# Consulting.
 
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
SQL and .NET performance profiling in one place
Investigate SQL and .NET code side-by-side with ANTS Performance Profiler 6, so you can see which is causing the problem without switching tools.
Go.NET
Build custom interactive diagrams, network, workflow editors, flowcharts, or software design tools. Includes many predefined kinds of nodes, links, and basic shapes. Supports layers, scrolling, zooming, selection, drag-and-drop, clipboard, in-place editing, tooltips, grids, printing, overview window, palette. 100% implemented in C# as a managed .NET Control. Document/View/Tool architecture with many properties&events. Optional automatic layout.
Dundas Software
Dundas Chart for .NET is the most advanced .NET charting package available today.  With an extremely complete feature set, elegant architecture and easy implementation, Dundas Chart can quickly add advanced Charting functionality to enhance and transform ASP.NET and Windows Forms applications.  Whether you are implementing charting into internal projects, or building applications for clients, Dundas Chart offers advanced technology and advanced results to get the most out of data.
60 FREE UI Controls from DevExpress
Register for your FREE copy on over 60 free presentation controls from DevExpress - Absolutely Free-of-Charge without any royalties or distribution costs. Visit Devexpress.com/60 today. Free controls include advanced lists box, dropdown calendar, rich text edit, spin edit, tab control and so much more!

DevExpress engineers feature rich presentation controls and reporting tools for WinForms, ASP.NET, WPF, and Silverlight. Our technologies help you build your best, see complex software with greater clarity and deliver compelling business solutions for Windows and the web in the shortest possible time.
Clickatell's SMS Gateway
Clickatell's Developer Solutions allow you to SMS enable any website or application via a range of API's. Learn More about our API connections.
Free access to .NET Memory Management video
Everything you need to know about Garbage Collection, Temporary Objects, Fragmentation, Finalization and common causes of memory leaks in .NET. Watch the video here.
Microsoft Visual Studio 2010
Visualize your workspace with new multiple monitor support, powerful Web development, new SharePoint support with tons of templates and Web parts, and more accurate targeting of any version of the .NET Framework. Get set to unleash your creativity.
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Developer-Ready ASP.NET 2.0 Web Hosting with 3 MONTHS FREE
Now supporting .NET 3.0 Framework with Windows Workflow Foundation, Windows Communication Foundation (WCF), Windows Presentation Foundation (WPF), windows CardSpace (WCS)! Providing more flexibility for Developers with Web Services Support and a User/Permission Manger. Also supporting MS SQL 2005/2000 with Real-Time Backups, FREE Automated Attach .MDF Tool, FREE SQL Restore and Shrink SQL DB Tools, and SQL
Read the Top 10 Books for Microsoft Developers, 15 Days FREE
Read the Top 10 Books for Microsoft Developers, 15 Days FREE
Try Safari Books Online - 15 Days FREE + 15% Off for 1 Year
Try Safari Books Online - 15 Days FREE + 15% Off for 1 Year
 
 Post a Feedback, Comment, or Question about this article
Subject:
Comment:
Nevron Chart
Become a Sponsor
 Comments
ASP.Net 4 Hosting is here
 Hosted by MaximumASP  |  Found a broken link?  |  Contact Us  |  Terms & conditions  |  Privacy Policy  |  Site Map  |  Suggest an Idea  |  Media Kit
Current Version: 5.2010.8.14
 © 2010  contents copyright of their authors. Rest everything copyright Mindcracker. All rights reserved.