我正在将一些应用程序从 .NET Core 1.1 更新到 2.0。这些应用程序在本地运行良好,但在我的 Linux VM 上更新运行时并部署后,出现错误:
An assembly specified in the application dependencies manifest (foo.deps.json) was not found: package: 'Microsoft.ApplicationInsights.AspNetCore', version: '2.1.1' path: 'lib/netstandard1.6/Microsoft.ApplicationInsights.AspNetCore.dll'
This assembly was expected to be in the local runtime store as the application was published using the following target manifest files: aspnetcore-store-2.0.0-linux-x64.xml;aspnetcore-store-2.0.0-osx-x64.xml;aspnetcore-store-2.0.0-win7-x64.xml;aspnetcore-store-2.0.0-win7-x86.xml
我认为这是因为运行时下载不会生成使用 Microsoft.AspNetCore.All 包时所需的新运行时存储文件夹。
我可以安装整个 SDK,这工作正常,但我更愿意继续只使用运行时。
如何在生产服务器上不需要 SDK 的情况下手动生成运行时缓存?
最佳答案
2017 年 12 月 4 日更新
ASP.NET Core 运行时现已列在 .NET Core 的主要下载页面上。 https://www.microsoft.com/net/download/linux
2017 年 10 月 3 日更新
您也可以从包源安装。
有关为 apt、yum、zypper 等添加 .NET Core 包源的说明,请参阅此链接:https://github.com/dotnet/core/blob/master/release-notes/download-archives/2.0.0-download.md#installing-net-core-on-linux
例如,如果你想在 Ubuntu 16 上安装,你可以这样做:
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt update
sudo apt install aspnetcore-store-2.0.0
原始答案
您可以从此处仅下载 ASP.NET Core 运行时存储:
https://dist.asp.net/runtimestore/2.0.0/linux-x64/aspnetcore.runtimestore.tar.gz
您还需要下载 .NET Core 2.0.0 运行时(请参阅 https://github.com/dotnet/core/blob/master/release-notes/download-archives/2.0.0-download.md)。
将这两个提取到同一个文件夹中,即运行时存储存档中的“store”和“additionalDeps”文件夹应该与 dotnet 可执行文件平行。
关于.net - 仅使用 .NET Core 2.0 运行时的 Linux 上缺少运行时存储错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45720022/