二、CoreCLR for Windows
在Windows上做编译怎么能少得了Visual Studio,由于Visual Studio 2017刚刚发布,所以选用Visual Studio 2017版本作为编译工具。
编译组件
Visual Studio 2017安装组件
.NET Desktop Development
All Required Components
.NET Framework 4-4.6 Development Tools
Desktop Development with C++
All Required Components
VC++ 2017 v141 Toolset (x86, x64)
Windows 8.1 SDK and UCRT SDK
VC++ 2015.3 v140 Toolset (x86, x64)
还有一个比较重要的问题,就是使用VS2017的话,还需要注册一个Visual Studio 2015的组件,需要运行如下命令:regsvr32.exe %VSINSTALLDIR%\Common7\IDE\msdia120.dll ,因为需要VS2017的环境变量,当然这也需要在Developer Command Prompt for VS2017 中运行。
windows编译
其实这部分有个小插曲就是,如果使用Visual Studio 2017编译的话会有一个小BUG,文档上给的例子是直接运行命令:
./build.cmd
但是会得到如下结果:
Microsoft.CSharp.Core.targets(106,11): error MSB4064: The "OverrideToolHost" parameter is not supported by the "Csc" task. Verify the parameter exists on the task, and it is a settable public instance property.