好奇環境是怎樣的,先不看任何東西,本身翻翻看。docker
docker run -it microsoft/dotnet:latest
mkdir hwapp cd hwapp dotnet new
看看目錄結構npm
-rwxr--r-- 1 root root 202 Jun 22 03:31 Program.cs* -rwxr--r-- 1 root root 348 Jun 22 03:31 project.json*
挑個小刺:每一個文件竟然全設定成了可執行屬性,看着就怪啊。 Program.cs
就一個Hellow World沒啥看頭。 project.json
:編程
{ "version": "1.0.0-*", "buildOptions": { "debugType": "portable", "emitEntryPoint": true }, "dependencies": {}, "frameworks": { "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { "type": "platform", "version": "1.0.0" } }, "imports": "dnxcore50" } } }
也還好。 dnxcore50的名稱之後可能會換掉。哎,.NET自己的名稱都很差,上樑不正下樑歪。json
小刺:最好直接換成yaml,都有點煩了JSON了,那雙引號,什麼破設計,另外也不能寫註釋。因此人家SpringBoot默認都換成yaml了。app
dotnet restore #####這個命令嚇人,求你改掉吧。實際是至關於npm install的意思,安裝依賴lib##### dotnet run
天然是獲得了Hello World。less
編譯生成的目錄和Windows下的習慣同樣,bin/Debug,和obj異步
bin/Debug/netcoreapp1.0/hwapp.dll bin/Debug/netcoreapp1.0/hwapp.deps.json bin/Debug/netcoreapp1.0/hwapp.pdb bin/Debug/netcoreapp1.0/hwapp.runtimeconfig.dev.json bin/Debug/netcoreapp1.0/hwapp.runtimeconfig.json
dotnet
是何方神聖root@88dab4dc4160:/hwapp# ls -lF `which dotnet` lrwxrwxrwx 1 root root 24 Jun 30 21:00 /usr/bin/dotnet -> /usr/share/dotnet/dotnet*
乾脆把/usr/share/dotnet/
下的東西都翻出來看看ide
./dotnet ./host/fxr/1.0.1/libhostfxr.so ./sdk/1.0.0-preview2-003121/corehost #這個顯然是主角luancher了 ./sdk/1.0.0-preview2-003121/libhostfxr.so ./sdk/1.0.0-preview2-003121/libhostpolicy.so ./shared/Microsoft.NETCore.App/1.0.0/corehost ./shared/Microsoft.NETCore.App/1.0.0/dotnet ./shared/Microsoft.NETCore.App/1.0.0/libclrjit.so #JIT Compiler ./shared/Microsoft.NETCore.App/1.0.0/libcoreclr.so #CLR運行時 ./shared/Microsoft.NETCore.App/1.0.0/libcoreclrtraceptprovider.so ./shared/Microsoft.NETCore.App/1.0.0/libdbgshim.so ./shared/Microsoft.NETCore.App/1.0.0/libhostfxr.so ./shared/Microsoft.NETCore.App/1.0.0/libhostpolicy.so ./shared/Microsoft.NETCore.App/1.0.0/libmscordaccore.so ./shared/Microsoft.NETCore.App/1.0.0/libmscordbi.so ./shared/Microsoft.NETCore.App/1.0.0/libsos.so ./shared/Microsoft.NETCore.App/1.0.0/libsosplugin.so ./shared/Microsoft.NETCore.App/1.0.0/libuv.so ##竟然你也在。異步編程用的。Node.JS裏用它作event loop的。 ./shared/Microsoft.NETCore.App/1.0.0/System.Globalization.Native.so ./shared/Microsoft.NETCore.App/1.0.0/System.IO.Compression.Native.so ./shared/Microsoft.NETCore.App/1.0.0/System.Native.so ./shared/Microsoft.NETCore.App/1.0.0/System.Net.Http.Native.so ./shared/Microsoft.NETCore.App/1.0.0/System.Net.Security.Native.so ./shared/Microsoft.NETCore.App/1.0.0/System.Security.Cryptography.Native.so
這應該就是最核心的乾貨了。異步編程
還有其餘好多dll的,和xarmarine裏的那一套比較像oop
./sdk/1.0.0-preview2-003121/.version ./sdk/1.0.0-preview2-003121/csc.deps.json ./sdk/1.0.0-preview2-003121/csc.dll ./sdk/1.0.0-preview2-003121/csc.runtimeconfig.json ./sdk/1.0.0-preview2-003121/dotnet.deps.json ./sdk/1.0.0-preview2-003121/dotnet.dll ./sdk/1.0.0-preview2-003121/dotnet.runtimeconfig.json ./sdk/1.0.0-preview2-003121/Microsoft.ApplicationInsights.dll ./sdk/1.0.0-preview2-003121/Microsoft.DiaSymReader.dll ./sdk/1.0.0-preview2-003121/Microsoft.DotNet.Archive.dll ... ./sdk/1.0.0-preview2-003121/Microsoft.DotNet.Configurer.dll ... ./sdk/1.0.0-preview2-003121/Microsoft.Extensions.Testing.Abstractions.dll ./sdk/1.0.0-preview2-003121/Newtonsoft.Json.dll ./sdk/1.0.0-preview2-003121/NuGet.Client.dll ./sdk/1.0.0-preview2-003121/NuGet.CommandLine.XPlat.dll ... ./sdk/1.0.0-preview2-003121/NuGet.RuntimeModel.dll ./sdk/1.0.0-preview2-003121/NuGet.Versioning.dll ./sdk/1.0.0-preview2-003121/nuGetPackagesArchive.lzma ./sdk/1.0.0-preview2-003121/runtimes/unix/lib/netstandard1.3/System.Diagnostics.TraceSource.dll ./sdk/1.0.0-preview2-003121/runtimes/win-x64/native/Microsoft.DiaSymReader.Native.amd64.dll ... ./sdk/1.0.0-preview2-003121/runtimes/win8-arm/native/Microsoft.DiaSymReader.Native.arm.dll ./sdk/1.0.0-preview2-003121/System.Diagnostics.TextWriterTraceListener.dll ... ./sdk/1.0.0-preview2-003121/System.Xml.XmlSerializer.dll ./shared/Microsoft.NETCore.App/1.0.0/Microsoft.CodeAnalysis.CSharp.dll ... ./shared/Microsoft.NETCore.App/1.0.0/Microsoft.VisualBasic.dll #VB.NET難道也要支持,扔了算了。 ... ./shared/Microsoft.NETCore.App/1.0.0/Microsoft.Win32.Registry.dll #Registry?? ./shared/Microsoft.NETCore.App/1.0.0/mscorlib.dll ./shared/Microsoft.NETCore.App/1.0.0/mscorlib.ni.dll ./shared/Microsoft.NETCore.App/1.0.0/sosdocsunix.txt ./shared/Microsoft.NETCore.App/1.0.0/System.AppContext.dll ... ./shared/Microsoft.NETCore.App/1.0.0/System.IO.dll #親切 ... ./shared/Microsoft.NETCore.App/1.0.0/System.Native.a #這是給誰用啊 ./shared/Microsoft.NETCore.App/1.0.0/System.Net.Http.dll ... ./shared/Microsoft.NETCore.App/1.0.0/System.Reflection.dll ... ./shared/Microsoft.NETCore.App/1.0.0/System.Runtime.dll ... ./shared/Microsoft.NETCore.App/1.0.0/System.Runtime.InteropServices.dll #這是什麼節奏, Native調用嗎? ... ./shared/Microsoft.NETCore.App/1.0.0/System.Runtime.Loader.dll ... ./shared/Microsoft.NETCore.App/1.0.0/System.Security.Cryptography.Csp.dll ... ./shared/Microsoft.NETCore.App/1.0.0/System.Security.Cryptography.OpenSsl.dll ... ./shared/Microsoft.NETCore.App/1.0.0/System.Text.RegularExpressions.dll ... ./shared/Microsoft.NETCore.App/1.0.0/System.Xml.ReaderWriter.dll ./shared/Microsoft.NETCore.App/1.0.0/System.Xml.XDocument.dll ...
另外,機器裏面還有一些.nuget管理包用的目錄,總體很乾淨。
繼續吐槽,NuGet這樣的名稱還不趁機改掉啊,難受死了。
回頭再接着分析。
root@88dab4dc4160:/hwapp# /usr/share/dotnet/shared/Microsoft.NETCore.App/1.0.0/corehost ./bin/Debug/netcoreapp1.0/hwapp.dll Hello World!
看來就是他了,好了,入口找到了。
再看看詳細信息,下次再分析一下。
root@88dab4dc4160:/hwapp# COREHOST_TRACE=1 /usr/share/dotnet/shared/Microsoft.NETCore.App/1.0.0/corehost ./bin/Debug/netcoreapp1.0/hwapp.dll 2>&1 |less 一堆結果爆屏,不貼了,可以看到用到什麼文件。 ...
dotnet和corehost的命令行幫助太少,看不出如何debug,但確定可以調試,只是這些細節看來還沒作完備啊。
下次在看看如何debug。而後在學學ASP.NET Core。