「[[マイクロソフト系技術情報 Wiki>http://techinfoofmicrosofttech.osscons.jp/]]」は、「[[Open棟梁Project>https://github.com/OpenTouryoProject/]]」,「[[OSSコンソーシアム .NET開発基盤部会>https://www.osscons.jp/dotNetDevelopmentInfrastructure/]]」によって運営されています。 -[[戻る>.NET Core]] * 目次 [#ydd371d7] #contents *概要 [#o7a2dee1] [[.NET Core]] の dotnetコマンドを使い倒す。 *詳細 [#ee74c390] **情報 [#n0b35fbd] ***基本情報 [#zee07804] $ dotnet --info .NET Command Line Tools (2.0.0) Product Information: Version: 2.0.0 Commit SHA-1 hash: cdcd1928c9 Runtime Environment: OS Name: ubuntu OS Version: 16.04 OS Platform: Linux RID: ubuntu.16.04-x64 Base Path: /usr/share/dotnet/sdk/2.0.0/ Microsoft .NET Core Shared Framework Host Version : 2.0.0 Build : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d ***テンプレート [#wcdf734a] 現時点でサポートされているテンプレートを知ることが出来る。 >dotnet new --help Templates Short Name Language Tags ---------------------------------------------------------------------------------------------------------------------------------- Console Application console [C#], F#, VB Common/Console Class library classlib [C#], F#, VB Common/Library WPF Application wpf [C#] Common/WPF WPF Class library wpflib [C#] Common/WPF WPF Custom Control Library wpfcustomcontrollib [C#] Common/WPF WPF User Control Library wpfusercontrollib [C#] Common/WPF Windows Forms (WinForms) Application winforms [C#] Common/WinForms Windows Forms (WinForms) Class library winformslib [C#] Common/WinForms Worker Service worker [C#] Common/Worker/Web Unit Test Project mstest [C#], F#, VB Test/MSTest NUnit 3 Test Project nunit [C#], F#, VB Test/NUnit NUnit 3 Test Item nunit-test [C#], F#, VB Test/NUnit xUnit Test Project xunit [C#], F#, VB Test/xUnit Razor Component razorcomponent [C#] Web/ASP.NET Razor Page page [C#] Web/ASP.NET MVC ViewImports viewimports [C#] Web/ASP.NET MVC ViewStart viewstart [C#] Web/ASP.NET Blazor Server App blazorserver [C#] Web/Blazor ASP.NET Core Empty web [C#], F# Web/Empty ASP.NET Core Web App (Model-View-Controller) mvc [C#], F# Web/MVC ASP.NET Core Web App webapp [C#] Web/MVC/Razor Pages ASP.NET Core with Angular angular [C#] Web/MVC/SPA ASP.NET Core with React.js react [C#] Web/MVC/SPA ASP.NET Core with React.js and Redux reactredux [C#] Web/MVC/SPA Razor Class Library razorclasslib [C#] Web/Razor/Library/Razor Class Library ASP.NET Core Web API webapi [C#], F# Web/WebAPI ASP.NET Core gRPC Service grpc [C#] Web/gRPC dotnet gitignore file gitignore Config global.json file globaljson Config NuGet Config nugetconfig Config Dotnet local tool manifest file tool-manifest Config Web Config webconfig Config Solution File sln Solution Protocol Buffer File proto Web/gRPC Examples: dotnet new mvc --auth Individual dotnet new webconfig dotnet new --help ***, etc. [#dbcdc001] **ビルド・デプロイ [#yda45833] ***ビルド [#l6b40fa8] 以下の様に使用している。 dotnet msbuild /p:Configuration=%BUILD_CONFIG% -v:d ".\xxxx.sln" -参考 --https://github.com/OpenTouryoProject/OpenTouryo/blob/develop/root/programs/CS/2_Build_NuGet_netstd20.bat --https://github.com/OpenTouryoProject/OpenTouryo/blob/develop/root/programs/CS/z_Common.bat ***デプロイ [#wd556f66] -以下のエラーが発生する場合、 Error: An assembly specified in the application dependencies manifest (hogehoge.deps.json) was not found: -以下の[[SCD設定>.NET Coreのデプロイ#w88a1ee1]]で発行する。 $ dotnet publish -c Release -r XXXX --self-contained --XXXXは、RuntimeIdentifiers(RID値)。 --RuntimeIdentifiersに何を設定すべきか?は以下のコマンドから確認できる。 $ cat /etc/os-release NAME="Ubuntu" VERSION="16.04.3 LTS (Xenial Xerus)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 16.04.3 LTS" VERSION_ID="16.04" HOME_URL="http://www.ubuntu.com/" SUPPORT_URL="http://help.ubuntu.com/" BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/" VERSION_CODENAME=xenial UBUNTU_CODENAME=xenial -参考 --deps.json ---Deep-dive into .NET Core primitives: deps.json, runtimeconfig.json, and dll's~ https://natemcmaster.com/blog/2017/12/21/netcore-primitives/ ---asp.net > core > コンソールアプリをWindowsServerで動作エラー~ https://qiita.com/sugasaki/items/3b9c16f3d62ffcf60227 --RID ---Microsoft Docs > .NET Core のランタイム識別子 (RID) のカタログ > RID の使用~ https://docs.microsoft.com/ja-jp/dotnet/core/rid-catalog#using-rids ---Linux OSのバージョンを調べる方法 - Qiita~ https://qiita.com/spite400k/items/96dfd0d4340afc35a22e ***, etc. [#s6c27913] **実行 [#b7716dc9] ***1 [#h8509f6a] ***通常実行 [#a1eef04e] ***トレース実行 [#h8509f6a] -システムコールをトレースして原因を特定する。 $ strace -o log.txt dotnet XXXX.dll -原因の特定 ログ・ファイルから以下を発見。 --カレント・ディレクトリが違っていてファイルを読み込めなかった。 open("SHA256RSA.pfx", O_RDONLY) = -1 ENOENT (No such file or directory) --bcrypt.dllファイルが読み込めなかったもよう。 open("/usr/lib/bcrypt.dll.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) ・・・ open("/usr/lib/libbcrypt.dll", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) ***, etc. [#r7e01e49] *参考 [#hac51311] **内部リンク [#v74cdaee] ***[[.NET Coreの開発]] [#y5ecd480] ***[[.NET Coreのデプロイ]] [#y78375b7] ***[[WSL上での.NET Core開発>Windows Subsystem for Linux#w85d0688]] [#ab75d757] ---- Tags: [[:.NET開発]], [[:.NET Core]]