在Linux中运行dotnet

在Linux中运行dotnet

我在让 dotnet 在我的机器上运行时遇到了一些困难,

uname -a
Linux Olympus 4.6.0-kali1-amd64 #1 SMP Debian 4.6.4-1kali1 (2016-07-21) x86_64 GNU/Linux

我已经通过安装了 dotnet corehttps://www.microsoft.com/net/core#linuxdebian

我遵循的命令是:

sudo apt-get install curl libunwind8 gettext
curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?linkid=843453
sudo mkdir -p /opt/dotnet && sudo tar zxf dotnet.tar.gz -C /opt/dotnet
sudo ln -s /opt/dotnet/dotnet /usr/local/bin

然后使用初始化代码的下一步,我得到:

dotnet --info
.NET Command Line Tools (1.0.1)

Product Information:
 Version:            1.0.1

Runtime Environment:
 OS Name:     kali
 OS Version:  2016.2
 OS Platform: Linux
 RID:         debian.8-x64
 Base Path:   /opt/dotnet/sdk/1.0.1

我得到的错误是:

dotnet new

Unhandled Exception: System.TypeInitializationException: The type initializer for 'Crypto' threw an exception. ---> System.TypeInitializationException: The type initializer for 'CryptoInitializer' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'System.Security.Cryptography.Native.OpenSsl': The specified module could not be found.
 (Exception from HRESULT: 0x8007007E)
   at Interop.CryptoInitializer.EnsureOpenSslInitialized()
   at Interop.CryptoInitializer..cctor()
   --- End of inner exception stack trace ---
   at Interop.Crypto..cctor()
   --- End of inner exception stack trace ---
   at Interop.Crypto.GetRandomBytes(Byte* buf, Int32 num)
   at System.IO.Path.GetCryptoRandomBytesOpenSsl(Byte* bytes, Int32 byteCount)
   at System.IO.Path.GetCryptoRandomBytes(Byte* bytes, Int32 byteCount)
   at System.IO.Path.GetRandomFileName()
   at Microsoft.DotNet.InternalAbstractions.TemporaryDirectory..ctor()
   at Microsoft.Extensions.EnvironmentAbstractions.DirectoryWrapper.CreateTemporaryDirectory()
   at Microsoft.DotNet.Configurer.NuGetPackagesArchiver..ctor()
   at Microsoft.DotNet.Cli.Program.ConfigureDotNetForFirstTimeUse(INuGetCacheSentinel nugetCacheSentinel)
   at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, ITelemetry telemetryClient)
   at Microsoft.DotNet.Cli.Program.Main(String[] args)
Aborted

我曾尝试研究这个问题,但大多数问题来自 MacOSx 并且与 Mac 相关。

我也尝试过更新 openssl:

openssl version
OpenSSL 1.1.0e  16 Feb 2017

我不太确定下一步该做什么。还有其他人遇到过这个问题或者知道我可以从这里去哪里吗?我已经能够在 linux mint 17 上成功使用 dotnet,但不能在 kali linux 上使用。

答案1

我终于能够弄清楚这一点。 (抱歉,我是该网站的新手,所以这个问题是我提出的,但当时我没有创建帐户)。

每当您安装最新的 Kali(这是 kali 2016.2),然后尝试从我提供的网站(实际上不是最新的)版本 1.0.1 安装最新的 dotnet core 时,都会有许多依赖项需要在 dotnet 运行之前降级到以前的版本。

首先是将 libicu57 降级为 libicu52(可以在 debian 软件包站点上找到)。这将解决以下问题:

Failed to initialize CoreCLR, HRESULT: 0x80131500

接下来,需要安装以前版本的libssl(从libssl1.0.2降级到libssl1.0.0)。这将解决本文的原始问题。

然后,需要降级libcurl3(libcurl3 7.52到libcurl3 7.38),以防止调用dotnet new、dotnet Restore、dotnet run时出现分段错误。

应该是这样。

相关内容