c# - dotnet restore 不复制 NETStandard.Library 和其他框架包
问题描述
我有一台不允许连接到任何网络的 PC。我需要在这台 PC 上进行网络标准项目。我之前曾在这种情况下使用过 Net Framework 项目,只是使用 nuget.exe 选项将包保存到文件夹,将文件夹复制到隔离的 PC 并使用 nuget 从该文件夹恢复包。
但是使用 dotnet restore 机制对 Net Standard 项目执行此操作会失败,因为缺少像 NETStandard.Library 这样的包。
我用来创建离线包文件夹的命令是:
dotnet restore solution.sln --packages offline_cache
将文件夹复制到我使用的隔离机器后:
dotnet restore solution.sln --source offline_cache
解决方案
听起来你想运行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
推荐阅读
- neo4j - GDS 虚拟图不同于组件查询
- python - 无法在 anaconda 提示符或命令提示符中运行需要 gdal 模块的 .py
- android - 无法更新 Firebase 数据?科特林
- java - 如果字符串的开头以关键字开头,则输出字符串的一部分
- android - DateUtils 是从两个包中导入的(flutter-app)
- xcode - xcode 输入 // 每当我按下回车键时,“。” 或标签
- reactjs - 无法在 FundValueCard.componentWillMount 读取未定义的属性(读取“状态”)
- .net - 针对 SQL Server 数据库中的用户表的 Blazor 客户端身份验证登录(我知道这个不好的做法,但这只是一个测试)
- opengl-es - glTexImage2D 上的应用程序冻结
- python - Pandas:在分隔符不一致和顺序不规则的关键字子字符串后提取数值,并将关键字和数字转换为列