gpt4 book ai didi

linux - Linux 上的 .NET Core 运行时包存储

转载 作者:太空宇宙 更新时间:2023-11-04 10:10:38 24 4
gpt4 key购买 nike

我创建了一个控制台应用程序并添加了 Newtonsoft.json 作为测试引用。

按照步骤操作后,我将应用程序 (netcoreapp2.0) 发布到 ubuntu.16.04-x64 版本并将其部署到 Ubuntu(16.04) 机器上,当我运行控制台应用程序时,它总是显示以下错误,即使是包存在于/usr/local/share/dotnet/store

未找到应用程序依赖项 list (RuntimePackageConsole.deps.json) 中指定的程序集:包:'Newtonsoft.Json',版本:'11.0.1'路径:'lib/netstandard2.0/Newtonsoft.Json.dll'当应用程序使用以下目标 list 文件发布时,该程序集应位于本地运行时存储中:artifact.xml

我将依赖json文件中Newtonsoft.Json.dll的路径改成绝对路径后就可以了。

有人在 Linux 上遇到过同样的问题吗?或者我如何找出原因,为什么应用程序无法通过依赖json文件中的相对路径加载包?

最佳答案

看起来您在发布代码时以 list 为目标。

Starting with .NET Core 2.0, it's possible to package and deploy apps against a known set of packages that exist in the target environment. The benefits are faster deployments, lower disk space use, and improved startup performance in some cases.

This feature is implemented as a runtime package store, which is a directory on disk where packages are stored (typically at /usr/local/share/dotnet/store on macOS/Linux and C:/Program Files/dotnet/store on Windows). Under this directory, there are subdirectories for architectures and target frameworks. The file layout is similar to the way that NuGet assets are laid out on disk:

A target manifest file lists the packages in the runtime package store. Developers can target this manifest when publishing their app. The target manifest is typically provided by the owner of the targeted production environment.

https://learn.microsoft.com/en-us/dotnet/core/deploying/runtime-store

因此您可能需要查看您的环境并确保您的包商店确实具有所需的库,或者您在没有 list 的情况下发布。

关于linux - Linux 上的 .NET Core 运行时包存储,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49269234/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com