. Corefx and CORECLR of net open source (III.)

Source: Internet
Author: User
Tags file copy

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

  1. Perform a build of the repo.
  2. Open \binaries\cmake\coreclr.sln in VS.
  3. Right click the INSTALL project and choose ' Set as StartUp project '
  4. Bring up the Properties page for the INSTALL project
  5. Select Configuration properties->debugging from the left side tree control
  6. Set command=$(SolutionDir)..\product\$(Platform)\$(Configuration)\corerun.exe
    1. This points to the folder where the built runtime binaries is present.
  7. Set Command arguments= <managed app you wish to run> (e.g. HelloWorld.exe)
  8. Set Working directory=$(SolutionDir)..\product\$(Platform)\$(Configuration)
    1. This points to the folder containing CoreCLR binaries.
  9. Press F11 to start debugging at WMAin on Corerun (or set a breakpoint in source and press F5 to run to it)
    1. 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.)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.