我有一台不允许连接到任何网络的PC。我需要在这台电脑上工作的网络标准项目。我以前在这个场景中使用过Net Framework项目,只是使用nuget.exe选项将包保存到一个文件夹,将该文件夹复制到隔离的PC,并使用nuget从该文件夹恢复包。
但是,使用dotnet恢复机制对Net Standard项目执行此操作会失败,因为缺少像NETStandard.Library这样的包。
我用来创建离线包文件夹的命令是:
dotnet restore solution.sln --packages offline_cache
在将文件夹复制到我使用的隔离机器后:
dotnet restore solution.sln --source offline_cache
发布于 2020-11-09 14:59:36
听起来您想要运行dotnet publish
https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish
请注意,如果您使用的是PackageReferences,则nuget restore
只会在全局缓存中安装依赖项,而不会将它们复制到本地https://docs.microsoft.com/en-us/nuget/consume-packages/package-restore
https://stackoverflow.com/questions/64749253
复制