やってみる

アウトプットすべく己を導くためのブログ。その試行錯誤すらたれ流す。

Raspbian stretch に .NET Core 2.2.101 をインストールした

 バイナリの圧縮ファイルを解凍してPATHを通すだけ。

対象環境

経緯

 .NET Standard を 1.6 から 2.0 にしたかった。ググるとなぜか .NET Core が出てきたので、とりあえず入れることにした。

参考

 2018-12-15時点では .NET Core 3.0 Preview 1 が最新だが、今回は2.2の最新版を対象とした。

手順

  1. こちらから圧縮ファイルをダウンロードする
  2. 展開(解凍)する
  3. 適当なパスに配置する
  4. パスを通す

パスを通す

 ~/.bash_profileまたは~/.bashrcの末尾に以下を追記する。

export DOTNET_ROOT=$HOME/dotnet 
export PATH=$PATH:$HOME/dotnet

 なお、パスは$HOME/dotnetに圧縮ファイルを展開した場合のもの。

実行

実行ファイルを叩く

$ dotnet

Usage: dotnet [options]
Usage: dotnet [path-to-application]

Options:
  -h|--help         Display help.
  --info            Display .NET Core information.
  --list-sdks       Display the installed SDKs.
  --list-runtimes   Display the installed runtimes.

path-to-application:
  The path to an application .dll file to execute.

--version

$ dotnet --version
2.2.101

-h

$ dotnet -h
.NET Command Line Tools (2.2.101)
Usage: dotnet [runtime-options] [path-to-application] [arguments]

Execute a .NET Core application.

runtime-options:
  --additionalprobingpath <path>     Path containing probing policy and assemblies to probe for.
  --additional-deps <path>           Path to additional deps.json file.
  --fx-version <version>             Version of the installed Shared Framework to use to run the application.
  --roll-forward-on-no-candidate-fx  Roll forward on no candidate shared framework is enabled.

path-to-application:
  The path to an application .dll file to execute.

Usage: dotnet [sdk-options] [command] [command-options] [arguments]

Execute a .NET Core SDK command.

sdk-options:
  -d|--diagnostics  Enable diagnostic output.
  -h|--help         Show command line help.
  --info            Display .NET Core information.
  --list-runtimes   Display the installed runtimes.
  --list-sdks       Display the installed SDKs.
  --version         Display .NET Core SDK version in use.

SDK commands:
  add               Add a package or reference to a .NET project.
  build             Build a .NET project.
  build-server      Interact with servers started by a build.
  clean             Clean build outputs of a .NET project.
  help              Show command line help.
  list              List project references of a .NET project.
  migrate           Migrate a project.json project to an MSBuild project.
  msbuild           Run Microsoft Build Engine (MSBuild) commands.
  new               Create a new .NET project or file.
  nuget             Provides additional NuGet commands.
  pack              Create a NuGet package.
  publish           Publish a .NET project for deployment.
  remove            Remove a package or reference from a .NET project.
  restore           Restore dependencies specified in a .NET project.
  run               Build and run a .NET project output.
  sln               Modify Visual Studio solution files.
  store             Store the specified assemblies in the runtime package store.
  test              Run unit tests using the test runner specified in a .NET project.
  tool              Install or manage tools that extend the .NET experience.
  vstest            Run Microsoft Test Engine (VSTest) commands.

Additional commands from bundled tools:
  dev-certs         Create and manage development certificates.
  ef                Entity Framework Core command-line tools.
  sql-cache         SQL Server cache command-line tools.
  user-secrets      Manage development user secrets.
  watch             Start a file watcher that runs a command when files change.

Run 'dotnet [command] --help' for more information on a command.

所感

 sdk/ディレクトリもあり、.dllファイルがたくさんあった。これをMonoDevelopが参照できれば、.NET Standard 2.0 になるのかな?