This article describes the use of compiled coreclr to execute the Hello CORECLR program written in C #. My machine environment is win 7 x64 en,vs2013.
(1) Compile test program, according to development guide, execute the build command as follows:
<repo_root>\tests\buildtest.cmd x64 release clean
In my environment, the compilation was successful and there was no error, and the development guide showed the wrong solution.
Once the compilation is complete, a vs project file is generated. Why compile test, because my side of the Win7, if you run the HelloCoreclr.exe program directly, will be prompted to find the DLL, and these DLLs using test compiled,
be able to get.
(2) Setting environment variable core_root
The path of the core_root points to < \coreclr\binaries\product\x64\debug> under
(3) Compiling HelloWorld program
Write a Hello World program in C #, compile the exe file, and paste the file copy into this path
< \ coreclr\binaries\product\x64\debug >
(4) You can start Corerun.exe directly with the command, run the HelloWorld program. As the simple hello coreclr! created for me The execution result of the program, which is initiated by Corerun.exe. Instead of the default. NET runtime, you are running with the open source CoreCLR run-time library.
(5) Api-ms-win-core-winrt-string-l1-1-0.dll can not find the problem
In fact, in the fourth step execution, not smooth, under the Win7 DLL can not find the error, the error box is as follows. The workaround is to < \coreclr\tests\src\packages\microsoft.dotnet.coreclr.testdependencies.1.0.0-prerelease\lib\aspnetcore50>
All copies of a DLL to < \coreclr\binaries\product\x64\debug> below, it's OK. This error is common and many people on GitHub have encountered this error.
(6) Debug of CORECLR
The development Guide provides a way to debug the CoreCLR, as follows, and the main thing to do is to set the properties of the install project in the Coreclr.sln project. According to the instructions, set the situation
Debugging CoreCLR
- Perform a build of the repo.
- Open \binaries\cmake\coreclr.sln in VS.
- Right click the INSTALL project and choose ' Set as StartUp project '
- Bring up the Properties page for the INSTALL project
- Select Configuration properties->debugging from the left side tree control
- Set command=
$(SolutionDir)..\product\$(Platform)\$(Configuration)\corerun.exe
- This points to the folder where the built runtime binaries is present.
- Set Command arguments=
<managed app you wish to run>
(e.g. HelloWorld.exe)
- Set Working directory=
$(SolutionDir)..\product\$(Platform)\$(Configuration)
- This points to the folder containing CoreCLR binaries.
- Press F11 to start debugging at WMAin on Corerun (or set a breakpoint in source and press F5 to run to it)
- As an example, set a breakpoint for the Eestartup function in Ceemain.cpp to break into CoreCLR startup.
Steps 1-8 only need to is done once, and then (9) can is repeated whenever you want to start debugging. The above can be do with Visual Studio 2013.
Press F11 after execution, enter the program entrance as follows, and then you can single-step debugging, (PS: My side of the environment variable is not set is also a single-step debugging when found, because the single-step debugging to start their own Hello World program, The Coreclr.dll load failure is prompted because the environment variable is not set. )
On top of that, running the Hello World program under Windows with open source CORECLR is implemented. If you want to know something about the bottom of coreclr, just follow the code and walk.
. Corefx and CORECLR of net open source (III.)