「.NET」の版間の差分
Kusanaginoturugi (トーク | 投稿記録) →Telemetry: リンクを修正 |
Kusanaginoturugi (トーク | 投稿記録) →Install multiple versions manually: タイトルだけ和訳 |
||
| 14行目: | 14行目: | ||
{{Tip|{{ic|PATH}} に {{ic|~/.dotnet/tools}} を追加してください。追加しない場合は、 dotnetツールはシェルから使うことができません。}} |
{{Tip|{{ic|PATH}} に {{ic|~/.dotnet/tools}} を追加してください。追加しない場合は、 dotnetツールはシェルから使うことができません。}} |
||
=== 複数のバージョンを手動でインストールする === |
|||
=== Install multiple versions manually === |
|||
You can install multiple versions of the .NET Core SDK or runtime side by side by using the [https://dot.net/v1/dotnet-install.sh dotnet-install.sh] script provided by the .NET Foundation. You can find the documentation of the script [https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script here]. |
You can install multiple versions of the .NET Core SDK or runtime side by side by using the [https://dot.net/v1/dotnet-install.sh dotnet-install.sh] script provided by the .NET Foundation. You can find the documentation of the script [https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script here]. |
||
2020年9月30日 (水) 12:00時点における版
.NET Core は Microsoft 製の新しいオープンソース C#, Visual Basic, F# ソフトウェアフレームワークです。先行の .NET Framework と異なり、クロスプラットフォームで動作し近代的なアプリケーションに適した設計が行われています。
インストール
.NET Core で管理されるアプリケーションを実行したいだけの場合は dotnet-runtime パッケージをインストールしてください。
.NET Core でアプリをビルドする場合は dotnet-sdk パッケージもインストールしてください。
Microsoft は .NET Core アプリをビルド・デバッグするときは Electron ベースのオープンソース IDE である Visual Studio Code を使うことを推奨しています。
PATH に ~/.dotnet/tools を追加してください。追加しない場合は、 dotnetツールはシェルから使うことができません。複数のバージョンを手動でインストールする
You can install multiple versions of the .NET Core SDK or runtime side by side by using the dotnet-install.sh script provided by the .NET Foundation. You can find the documentation of the script here.
For instance, this command would install the latest version found in the "current" channel in /usr/share/dotnet:
# ./dotnet-install.sh --install-dir /usr/share/dotnet -channel Current -version latest
You may want to simulate the installation first by using the -Dryrun flag.
Once installed, you can verify the SDKs available:
$ dotnet --list-sdks 2.2.108 [/usr/share/dotnet/sdk] 3.0.103 [/usr/share/dotnet/sdk] $ dotnet --version 3.0.103
Install multiple versions via AUR
Some of the AUR dotnet packages are made to be installed alongside each other. Only one host package (dotnet-host-binAUR or dotnet-host) is needed containing the command-line tool and you can install any of the available SDKs and Runtimes (latest packages of all major versions) next to it. List of compatible packages:
- dotnet-host-binAUR, dotnet-runtime-binAUR, aspnet-runtime-binAUR, dotnet-sdk-binAUR
- dotnet-host-previewAUR, dotnet-runtime-previewAUR, aspnet-runtime-previewAUR, dotnet-sdk-previewAUR
- dotnet-runtime-3.0AUR, aspnet-runtime-3.0AUR, dotnet-sdk-3.0AUR,
- dotnet-runtime-2.2AUR, aspnet-runtime-2.2AUR, dotnet-sdk-2.2AUR, dotnet-sdk-2.2-vs2017AUR
- dotnet-runtime-2.1AUR, aspnet-runtime-2.1AUR, dotnet-sdk-2.1AUR
Install PowerShell Core
You can install PowerShell Core as a "global" tool also [1] [2]
# dotnet tool install --global PowerShell
to update to current version
# dotnet tool update --global PowerShell
Telemetry
Telemetry is enabled by default but can be disabled by 環境変数の設定 DOTNET_CLI_TELEMETRY_OPTOUT=1.
Troubleshooting
It was not possible to find any compatible framework version
If you get the following error when you try to run a newly created project, you no longer need to set a DOTNET_ROOT variable as described in the solutions of various GitHub issues. Arch's dotnet package (as of 3.1) installs it to the Microsoft recommended location of /usr/share/dotnet.
$ dotnet run
It was not possible to find any compatible framework version The framework 'Microsoft.AspNetCore.App', version '3.1.0' was not found. - No frameworks were found. You can resolve the problem by installing the specified framework and/or SDK. The specified framework can be found at: - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.AspNetCore.App&framework_version=3.1.0&arch=x64&rid=arch-x64
This is caused because the runtime is shipped as a separate package in Arch. You just need to make sure you have the aspnet-runtime package installed as well.
"the required library libhostfxr.so could not be found" error
Some of the dotnet SDK tools (for example libman, dotnet-watch etc.) may expect you to have the environment variable DOTNET_ROOT pre-configured. If it's not, an error like this one could be observed: [3]
A fatal error occurred, the required library libhostfxr.so could not be found. If this is a self-contained application, that library should exist in [/home/my_user/.dotnet/tools/.store/microsoft.web.librarymanager.cli/1.0.172/microsoft.web.librarymanager.cli/1.0.172/tools/netcoreapp2.1/any/]. If this is a framework-dependent application, install the runtime in the default location [/usr/share/dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location.
The workaround is to manually export DOTNET_ROOT in your shell:
~/.bashrc
export DOTNET_ROOT=/opt/dotnet
SDK specified could not be found
This is believed to caused by a conflict between the Mono and MSBuild SDK libs and the dotnet core ones. To fix this export the path manually in your shell (replacing the version number as necessary) e.g:
~/.bashrc
export MSBuildSDKsPath=$( echo /usr/share/dotnet/sdk/3.*/Sdks );