首页 > 其他 > 详细

How to build mscorlib.dll with visual studio

时间:2014-03-11 16:16:29      阅读:702      评论:0      收藏:0      [点我收藏+]
Recently, Microsoft Corportation has released a new look for .NET Reference Source. And you may find it here, http://referencesource.microsoft.com/. As you download the full code provided by http://referencesource.microsoft.com/DotNetReferenceSource.zip, you may notice these tips as follows:
"Download the entire source code as a .zip file. The archive includes a solution and project files that can be opened in Visual Studio. This solution will not build because it is missing crucial components such as resources, XAML files, etc. but it will be sufficient to browse the source code inside Visual Studio." As metioned above, "This solution will not build because it is mising crucial components such as resources, XAML files, etc.", I decided to try to build mscorlib.dll with visual studio based on this project. The build environment is Windows 7 and Visual Studio  2013, and you may need ILSpy in order to solve problems such as "file missing errors".
 
Firstly, I deleted all the other project such as "ComSvcConfig", "Microsoft.VisualBasic" in ndp.sln. When I have done this, the ndp.sln file is like this :

 

Secondly, I need to copy all the files needed in mscorlib project. These files are located in "/ndp/clr/src/BCL/*.*", you need to copy all these files.

 
What‘s more, if you open the ndp.sln in Visual Studio 2013 and build the solution, you may find some errors such as "Compiler Error Message: CS0234: The type or namespace name ‘Runtime‘ does not exist in the namespace ‘Microsoft‘ (are you missing an assembly reference?)". As you open the "/ndp/clr/src/BCL/Microsoft/" folder, you can only find "Win32" subfloder. Well, you need to create a "Runtime" subfloder manually. And under the Runtime floder, you need to create a "Hosting" subfloder as well. As you explore the mscorlib.dll with ILSpy, you may find that there is a namespace name "Microsoft.Runtime.Hosting", and there are three class or interface in the namespace "Microsoft.Runtime.Hosting", IClrStrongName, IClrStrongNameUsingIntPtr and StrongNameHelpers. Now, you need to copy the code in ILSpy and paste them in right order.
 
If you rebuild the project, you will still find some file missing errors. In order to solve these problems, follow these steps :
Step1 : create "\ndp\clr\src\BCL\System\CompatibilityFlag.cs" file and paste the code as follows.

 

Step2 : create "\ndp\clr\src\BCL\System\AppDomainSetup.cs" file and paste the code as follows.

 

Step3 : create "\ndp\clr\src\BCL\AssemblyRef.cs" file and paste the code as follows.

 

Step4 : create "\ndp\clr\src\BCL\ThisAssembly.cs" and paste the code as follows.

 

Step5 : modify "\ndp\clr\src\BCL\System\Globalization\RegionInfo.cs".
before :

 

after :

 

Now, if you rebuild the project, you may get some warnnings with no errors. And the mscorlib.dll is builded with visual studio. Just enjoy it!

How to build mscorlib.dll with visual studio,布布扣,bubuko.com

How to build mscorlib.dll with visual studio

原文:http://www.cnblogs.com/ilcc/p/3593681.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!