성태의 닷넷 이야기
홈 주인
모아 놓은 자료
프로그래밍
질문/답변
사용자 관리
사용자
메뉴
아티클
외부 아티클
유용한 코드
온라인 기능
MathJax 입력기
최근 덧글
[정성태] Reordering on an Alpha processor ;...
[정성태] 공유 감사합니다. ^^ 참고로, WPF에서 WindowsF...
[Tom Lee] 답변 감사합니다. 나름의 해결책 연구해보고 여기에도 공유해봅니다...
[정성태] 아래의 글을 보면, MoveWindow 하면 될 듯한데요. ^^...
[Tom Lee] 안녕하세요 올려주신 글 참고하여 WPF 어플리케이션 안에 Uni...
[정성태] A graphical depiction of the steps ...
[정성태] 질문을 주셔서 출판사 측에 문의를 했습니다. 약 한 달 정도 후...
[Thorondor
] @정성태 개인 블로그인데도 거의 커뮤니티 급 인 것 같아요. 요...
[정성태] Roll A Lisp In C - Reading ; https...
[정성태] Java - How to use the Foreign Funct...
글쓰기
제목
이름
암호
전자우편
HTML
홈페이지
유형
제니퍼 .NET
닷넷
COM 개체 관련
스크립트
VC++
VS.NET IDE
Windows
Team Foundation Server
디버깅 기술
오류 유형
개발 환경 구성
웹
기타
Linux
Java
DDK
Math
Phone
Graphics
사물인터넷
부모글 보이기/감추기
내용
<div style='display: inline'> <h1 style='font-family: Malgun Gothic, Consolas; font-size: 20pt; color: #006699; text-align: center; font-weight: bold'>.NETCore = CoreFX + CoreCLR</h1> <p> ".NET Core"가 공개되었습니다. <br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > CoreCLR Now Open Source ; <a target='tab' href='http://www.i-programmer.info/news/89-net/8247-coreclr-now-open-source.html'>http://www.i-programmer.info/news/89-net/8247-coreclr-now-open-source.html</a> </pre> <br /> 쉽게 말해서 .NET Core는 우리가 알고 있는 ".NET Framework"의 소형 버전이라고 보시면 됩니다.<br /> <br /> 닷넷으로 만든 프로그램이 동작하려면 크게 2가지 구성요소가 있어야 하는데요. 바로 "JIT" 컴파일 등을 담당하는 런타임 환경이 그 하나이고, 또 다른 구성 요소는 우리가 프로그램을 만들 때 사용하는 여러 타입들이 정의된 "BCL(Base Class Library)"이 그것입니다.<br /> <br /> 따라서, .NET Core, CoreFX, CoreCLR을 기존의 ".NET Framework"과 비교하면 이렇게 됩니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > .NET Core = CoreFX + CoreCLR .NET Framework = BCL + CLR </pre> <br /> 그리고, CoreFX, CoreCLR의 소스 코드가 모두 github에 올라가 진행 중입니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > dotnet/coreclr ; <a target='tab' href='https://github.com/dotnet/coreclr'>https://github.com/dotnet/coreclr</a> dotnet/corefx ; <a target='tab' href='https://github.com/dotnet/corefx'>https://github.com/dotnet/corefx</a> </pre> <br /> 게다가 <a target='tab' href='https://github.com/dotnet/coreclr'>https://github.com/dotnet/coreclr</a> 글의 내용이 흥미진진합니다.<br /> <br /> <div style='BACKGROUND-COLOR: #ccffcc; padding: 10px 10px 5px 10px; MARGIN: 0px 10px 10px 10px; FONT-FAMILY: Malgun Gothic, Consolas, Verdana; COLOR: #005555'> CoreCLR is a subset of the .NET Framework CLR. They share the same codebase and are updated together. For example, an update to the .NET GC improves both CoreCLR and the .NET Framework CLR.<br /> </div><br /> <br /> CoreCLR이 .NET Framework CLR과 동일한 코드 기반이기 때문에, 이제는 .NET Framework CLR 측에서 문제가 발생했을 때 추측만이 아니라 검증도 해볼 수 있게 된 것입니다.<br /> <br /> 마이크로소프트 측은 기존 Mono에서 동작 중인 ASP.NET 5도 CoreCLR이 Linux/Mac용으로 포팅되는 시점에는 CoreCLR로 이전하겠다는 발표도 하고 있습니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > CoreCLR is now Open Source ; <a target='tab' href='https://devblogs.microsoft.com/dotnet/coreclr-is-now-open-source/'>https://devblogs.microsoft.com/dotnet/coreclr-is-now-open-source/</a> </pre> <br /> <div style='BACKGROUND-COLOR: #ccffcc; padding: 10px 10px 5px 10px; MARGIN: 0px 10px 10px 10px; FONT-FAMILY: Malgun Gothic, Consolas, Verdana; COLOR: #005555'> We’ve been talking about ASP.NET 5 for nearly a year now. You can build ASP.NET 5 apps with the .NET Framework or with .NET Core. <span style='color: blue; font-weight: bold'>Today, ASP.NET 5 uses the Mono runtime to run on Linux and Mac. Once .NET Core supports Linux and Mac, then ASP.NET 5 will move to using .NET Core for those platforms.</span> </div><br /> <br /> 이렇게 되면 Mono의 향방이 궁금해집니다. 개인적인 의견으로는, Mono가 없어진다기 보다는 CoreCLR의 일정 부분을 흡수하지 않겠는가... 하는 생각을 해봅니다. 혹시 Mono가 CoreCLR 코드 베이스를 완전하게 흡수하는 것은 어떨까요? 글쎄요!!! 그렇다면 하위 호환성을 아예 포기해야 할 것입니다. 가령, <a target='tab' href='http://www.sysnet.pe.kr/2/0/1805'>Mono Profiler</a>의 규격은 자체 확장한 것이기 때문에 CoreCLR의 Profiler 규격과는 맞지 않습니다. 그런 부분의 호환을 포기한다면 Mono가 CoreCLR을 흡수해 대대적인 성능 향상을 기대해 볼 수도 있을 것입니다. (사실... 저 쪽 동네는 하위 호환을 그다지 중요하지 않게 생각하는 분위기가 있으므로.)<br /> <br /> <hr style='width: 50%' /><br /> <br /> 그럼, 어디 ^^ 윈도우 용으로 빌드를 해볼까요?<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > Developer Guide - Building the repository ; <a target='tab' href='https://github.com/dotnet/coreclr/wiki/Developer-Guide'>https://github.com/dotnet/coreclr/wiki/Developer-Guide</a> </pre> <br /> 우선, <a target='tab' href='https://codeload.github.com/dotnet/coreclr/zip/master'>coreclr-master.zip</a>를 다운로드 받아 압축을 해제합니다. 제 경우에는 e:\coreclr로 했습니다.<br /> <br /> 그다음 cmake를 다운로드 받습니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > cmake-3.1.3-win32-x86.zip ; <a target='tab' href='http://www.cmake.org/files/v3.1/cmake-3.1.3-win32-x86.zip'>http://www.cmake.org/files/v3.1/cmake-3.1.3-win32-x86.zip</a> </pre> <br /> 제 경우에는 e:\cmake에 압축을 해제했습니다.<br /> <br /> 이제 cmd.exe 창을 열고 다음과 같이 SET 명령을 수행해 cmake 폴더를 포함시켜둡니다. (또는 전역 환경 변수에 포함해둡니다.)<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > SET PATH=%PATH%;e:\cmake\bin </pre> <br /> 그리고, Visual Studio도 설치되어 있어야 합니다. 없다면 무료 버전인 Visual Studio Community를 다운로드 받아 설치합니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > Visual Studio Community ; <a target='tab' href='https://app.vssps.visualstudio.com/profile/review?download=true&family=VisualStudio&edition=Community&release=VisualStudio2013Upd4'>https://app.vssps.visualstudio.com/profile/review?download=true&family=VisualStudio&edition=Community&release=VisualStudio2013Upd4</a> </pre> <br /> 설치 후, "DIA SDK"가 있는지 아래의 경로에서 확인합니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > "C:\Program Files (x86)\Microsoft Visual Studio 12.0\DIA SDK" </pre> <br /> 없으면, 이 글의 마지막에 있는 DIA SDK 관련 설명을 참조하세요.<br /> <br /> 이걸로 사전 설치 준비 작업은 끝!<br /> <br /> (** 2016-08-23 업데이트: 빌드를 위해 Python이 추가되었습니다. 자세한 사항은 <a href="https://github.com/dotnet/coreclr/blob/master/Documentation/building/windows-instructions.md">Build CoreCLR on Windows</a> 글을 참고하세요.) <br /> <br /> <hr style='width: 50%' /><br /> <br /> 자, 이제 명령행에서 루트에 있는 build.cmd 파일을 실행해 빌드해 줍니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > E:\coreclr><span style='color: blue; font-weight: bold'>build.cmd</span> Commencing CoreCLR Repo build Checking pre-requisites... Commencing build of native components for Windows_NT.x64.debug -- The C compiler identification is MSVC 18.0.31101.0 -- The CXX compiler identification is MSVC 18.0.31101.0 -- Check for working C compiler using: Visual Studio 12 2013 Win64 -- Check for working C compiler using: Visual Studio 12 2013 Win64 -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler using: Visual Studio 12 2013 Win64 -- Check for working CXX compiler using: Visual Studio 12 2013 Win64 -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- The ASM_MASM compiler identification is MSVC -- Found assembler: c:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/ml64.exe -- Configuring done -- Generating done -- <span style='color: blue; font-weight: bold'>Build files have been written to: E:/coreclr/binaries/intermediates/Windows_NT.x64.debug</span> Build started 2015-03-04 10:22:07. ...[생략]... </pre> <br /> 빌드 하다가 "error CS0518: Predefined type 'System.Object' is not defined or imported" 오류가 발생할 수 있는데 일단 이것은 무시합니다. 그 오류 메시지가 나타날때까지 빌드가 진행되었으면 이미 필요한 DLL들은 다음의 폴더에 생성된 이후입니다. (예를 들어, coreclr.dll, mscorlib.dll, sos.dll, ...)<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > E:\coreclr\binaries\Product\Windows_NT.x64.debug </pre> <br /> 이렇게 build.cmd로 빌드를 한번 해주면 "E:\coreclr\binaries\intermediates\Windows_NT.x64.debug\CoreCLR.sln" 파일이 생성됩니다. 이후부터는, 이것을 Visual Studio에 로드해서 컴파일하고 디버깅할 수 있습니다. 물론, "F5 디버깅"도 가능하겠지요? ^^ 방법은 이전에 설명했던 글과 유사하게 진행하시면 됩니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > OpenCover 소스 코드 분석을 Visual Studio 2013에서 하는 방법 ; <a target='tab' href='http://www.sysnet.pe.kr/2/0/2883'>http://www.sysnet.pe.kr/2/0/2883</a> </pre> <br /> <hr style='width: 50%' /><br /> <br /> 그럼, 이제 (Microsoft .NET Framework 런타임이 아닌) "E:\coreclr\binaries\Product\Windows_NT.x64.debug" 폴더에 있는 CoreCLR 런타임으로 간단한 응용 프로그램 하나 실행해 볼까요? ^^<br /> <br /> Visual Studio를 이용해 아래와 같은 콘솔 프로젝트를 하나 만들어 빌드하고,<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Console.WriteLine("Main"); Console.ReadLine(); } } } </pre> <br /> "E:\coreclr\binaries\Product\Windows_NT.x64.debug" 폴더의 corerun.exe를 이용해 다음과 같이 실행해 볼 수 있습니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > E:\coreclr\binaries\Product\Windows_NT.x64.debug>corerun .\samples\ConsoleApplication1.exe Main </pre> <br /> Console.ReadLine 코드는 일부러 집어 넣은 것입니다. 그 코드로 인해 실행 중에 대기를 하면, 그 시점에 Process Explorer를 이용해 재미있는 결과를 확인할 수 있습니다. 즉, ConsoleApplication1.exe 파일이 CoreRun.exe의 자식이 아닌 CoreRun.exe 자체 내에서 DLL처럼 로드되어 Main 함수가 실행된 것을 확인할 수 있습니다.<br /> <br /> <img onclick='toggle_img(this)' class='imgView' alt='corerun_1.png' src='/SysWebRes/bbs/corerun_1.png' /><br /> <br /> 그러니까, java.exe가 .class파일을 실행하는 것처럼, coreclr에서는 exe파일은 단지 "Main 메서드를 포함하고 있는 dll"이라는 의미에 불과합니다.<br /> <br /> 물론, 윈도우 환경에서는 ConsoleApplication1.exe 파일을 직접 실행할 수 있고 그런 경우에는 .NET Framework의 영향을 받게 됩니다. (나중에 CoreCLR이 Max/Linux 환경에 포팅이 되면, 방금 전에 만들어 둔 ConsoleApplication1.exe 파일만 다른 환경의 CoreCLR 폴더에 복사해 동일하게 corerun을 이용해 실행해 볼 수 있습니다.)<br /> <br /> <hr style='width: 50%' /><br /> <br /> 예전에 아래와 같은 주제로 이야기한 적이 있었지요?<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > .NET EXE 파일을 닷넷 프레임워크 버전에 상관없이 실행할 수 있을까요? - 두 번째 이야기 ; <a target='tab' href='http://www.sysnet.pe.kr/2/0/1746'>http://www.sysnet.pe.kr/2/0/1746</a> </pre> <br /> 이젠, corerun.exe 파일과 함께 몇몇 필요한 파일을 함께 배포해 주면 더 이상 .NET Framework 버전에 의존하지 않는 응용 프로그램을 제작할 수 있습니다.<br /> <br /> 단지, 크로스-플랫폼적인 것이 고려되었기 때문에 아직 WinForm/WPF/WCF와 같은 라이브러리들은 CoreFX에서 지원되지 않아 사용할 수 없습니다. (지원 여부가 불투명 합니다. 아마... 이런 부분은 지원한다고 해도 시간이 제법 걸릴 것입니다.) 현재로써는 ASP.NET 5나 콘솔 응용 프로그램 정도를 개발할 때 쓸 수 있습니다. 아쉽지만! ^^<br /> <br /> 참고로 맥 운영체제인 OSX에서도 coreclr을 빌드하는 글이 있습니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > Building and Running .NET’s CoreCLR on OS X ; <a target='tab' href='http://praeclarum.org/post/110552954728/building-and-running-nets-coreclr-on-os-x'>http://praeclarum.org/post/110552954728/building-and-running-nets-coreclr-on-os-x</a> </pre> <br /> 점점 더 영역을 확장할 테니 기대해도 좋을 듯 합니다. ^^<br /> <br /> <hr style='width: 50%' /><br /> <br /> 지금부터는 빌드 시 겪을 수 있는 오류 상황에 대한 설명입니다.<br /> <br /> 만약 DIA SDK가 정상적으로 설치되지 않았다면 다음과 같은 오류가 발생합니다.<br /> <br /> <div style='BACKGROUND-COLOR: #ccffcc; padding: 10px 10px 5px 10px; MARGIN: 0px 10px 10px 10px; FONT-FAMILY: Malgun Gothic, Consolas, Verdana; COLOR: #005555'> E:\coreclr><span style='color: blue; font-weight: bold'>build.cmd</span> Commencing CoreCLR Repo build<br /> <br /> Checking pre-requisites...<br /> <br /> Commencing build of native components for Windows_NT.x64.debug<br /> <br /> Error: DIA SDK is missing at "C:\Program Files (x86)\Microsoft Visual Studio 12.0\DIA SDK". This is due to a bug in the Visual Studio installer. It does not install DIA SDK at "C:\Program Files (x86)\Microsoft Visual Studio 12.0\" but rather at VS install location of previous version. Workaround is to copy DIA SDK fold<br /> er from VS install location of previous version to "C:\Program Files (x86)\Microsoft Visual Studio 12.0\" and then resume build.<br /> Visual Studio 2013 Express does not include the DIA SDK. You need Visual Studio 2013 Community (free).<br /> See: <a target='tab' href='https://github.com/dotnet/coreclr/wiki/Developer-Guide#prerequisites'>https://github.com/dotnet/coreclr/wiki/Developer-Guide#prerequisites</a><br /> </div><br /> <br /> 오류 메시지에 의하면, Visual Studio 2013을 설치할 때 이전 버전의 Visual Studio가 설치되어 있으면 그쪽 폴더에 설치된다고 합니다. 예를 들어, 제 경우에는 컴퓨터에 Visual Studio 2012가 설치되어 있었는데 그래서 다음의 경로에 DIA SDK가 설치되어 있었습니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > C:\Program Files (x86)\<span style='color: blue; font-weight: bold'>Microsoft Visual Studio 11.0</span>\DIA SDK </pre> <br /> 따라서 다음의 명령을 관리자 권한으로 실행한 cmd.exe 창에서 실행해 주면 됩니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > robocopy "C:\Program Files (x86)\Microsoft Visual Studio 11.0\DIA SDK" "C:\Program Files (x86)\Microsoft Visual Studio 12.0\DIA SDK" /S </pre> <br /> 또 다른 상황으로, 만약 cmake가 정상적으로 PATH에 연결되어 있지 않으면 다음과 같은 오류가 발생합니다.<br /> <br /> <div style='BACKGROUND-COLOR: #ccffcc; padding: 10px 10px 5px 10px; MARGIN: 0px 10px 10px 10px; FONT-FAMILY: Malgun Gothic, Consolas, Verdana; COLOR: #005555'> E:\coreclr><span style='color: blue; font-weight: bold'>build.cmd</span> Commencing CoreCLR Repo build<br /> <br /> Checking pre-requisites...<br /> <br /> CMake is a pre-requisite to build this repository but it was not found on the path. Please install CMake from <a target='tab' href='http://www.cmake.org/download/'>http://www.cmake.org/download/</a> and ensure it is on your path.<br /> </div><br /> <br /> 당연히 cmake를 다운로드/압축 풀고 PATH 환경 변수에 경로를 설정해 주면 문제가 해결됩니다.<br /> <br /> 마지막으로, 본문에서 다뤘던 "CSC : error CS0518: Predefined type 'System.Object' is not defined or imported" 오류가 빌드를 완료하지 못하고 나타나는 문제입니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > Commencing build of tests for Windows_NT.x64.debug Doing a clean test build Starting the Test Build Restoring build tools... Restoring all package dependencies... E:\coreclr\tests\src\packages\Microsoft.DotNet.BuildTools.1.0.21-prerelease\lib\packageresolve.targets(25,5): warning : Unable to resolve the assets of System.Diagnostics.Process: Couldn't find a matching group [E:\coreclr\tests\src\Common\Coreclr.TestWrapper\Coreclr.TestWrapper.csproj] E:\coreclr\tests\src\packages\Microsoft.DotNet.BuildTools.1.0.21-prerelease\lib ...[생략].... E:\coreclr\tests\src\packages\Microsoft.DotNet.BuildTools.1.0.21-prerelease\lib\packageresolve.targets(25,5): warning : Unable to resolve the assets of System.Reflection.Primitives: Couldn't find a matching group [E:\coreclr\tests\src\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj] CSC : error CS0518: Predefined type 'System.Object' is not defined or imported [E:\coreclr\tests\src\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj] ...[생략].... </pre> <br /> 최초 발생하는 오류는 System.Object를 찾을 수 없다는 것입니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > CSC : error CS0518: Predefined type 'System.Object' is not defined or imported [E:\coreclr\tests\src\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj] </pre> <br /> 왜냐하면 해당 csproj 프로젝트 빌드가 nostdlib 옵션으로 컴파일되기 때문인데 구체적인 해결 방법은 다음에 더 알아보도록 하겠습니다. 지금은 일단, 이 빌드 오류가 발생해도 CoreCLR 빌드는 정상적으로 되었으므로 무시해도 좋습니다.<br /> </p><br /> <br /><hr /><span style='color: Maroon'>[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]</span> </div>
첨부파일
스팸 방지용 인증 번호
5119
(왼쪽의 숫자를 입력해야 합니다.)