我试图配置一个简单的管道来构建和部署我的asp.net核心应用程序到共享主机,但它总是失败恢复Newtonsoft.Json,争论该项目是可构建的并且完全适用于本地机器,我的ci文件看起来如下:
image: microsoft/dotnet:latest
stages:
- build
before_script:
- dotnet restore -s https://api.nuget.org/v3/index.json --packages ./.nuget/
build:
stage: build
script:
- "dotnet build"
我在管道中遇到的错误是:
/usr/share/dotnet/sdk/2.1.402/Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Newtonsoft.Json". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
我也尝试过dotnet还原,但结果相同。
我找出了问题,我添加了Newtonsoft.Json作为参考,而不是从nuget安装它(实际上visual studio通过快速操作添加它作为参考),所以我删除了引用并将其安装为包,一切都运行完美