[英]Azure Continuous deployment fails on Newtonsoft while VS publishing works
I added a new packages that required Newtonsoft.Json
version >= 9.0.1 while so far I had 8.0.2. 我添加了一个新的软件包,需要
Newtonsoft.Json
版本> = 9.0.1,而到目前为止,我有8.0.2。
The solution builds and runs fine on VS. 该解决方案在VS上构建并运行良好。 However, when I push the branch, the continuous deployment build on Azure fails.
但是,当我推送分支时,Azure上的持续部署构建失败。
The type or namespace name 'Newtonsoft' could not be found
找不到类型或命名空间名称“Newtonsoft”
There isn't any error on assembly loading or resolving. 装配加载或解析时没有任何错误。
However if I publish on Azure from Visual Studio it works. 但是,如果我从Visual Studio中在Azure上发布它就可以了。
What can be wrong with my CD build and how can I repare it? 我的CD构建有什么问题,我该如何重新制作?
The solution has only one project. 该解决方案只有一个项目。
Make sure that you have same Newtonsoft.Json version across all your projects. 确保所有项目中都有相同的Newtonsoft.Json版本。
Check that Newtonsoft.Json assemblyBinding in config files is right and same across all projects 检查所有项目中配置文件中的Newtonsoft.Json assemblyBinding是否正确
Make sure that you Enabled NuGet Package Restore 确保已启用NuGet包还原
All the SOF questions about uninstalling\\reinstalling Newtonsoft
package as well as checking assemblyBindings etc led me in a wrong direction. 有关卸载\\重新安装
Newtonsoft
软件包以及检查assemblyBindings等所有SOF问题都导致我的方向错误。
My build server (Azure Continuous Deployment) loads packages in a folder called packages at the root of the solution. 我的构建服务器(Azure Continuous Deployment)将软件包加载到解决方案根目录下名为packages的文件夹中。 However as I have many solutions on my machine, I have a single package folder elsewhere.
但是由于我的机器上有很多解决方案,我在其他地方有一个包文件夹。 In order for the build server to work, I had created a junction package folder at the root of my solution linked to the proper package folder of my machine.
为了使构建服务器正常工作,我在解决方案的根目录下创建了一个联结包文件夹,链接到我的机器的正确包文件夹。 What I had forgotten is that when I add new packages, Visual Studio put the paths of the correct package folder rather than the junction.
我忘记的是,当我添加新包时,Visual Studio会放置正确的包文件夹而不是结点的路径。
Hence, in order to repair my server build I just had to edit my csproj
file to redirect new (and updated like Newtonsoft
) packages to the junction folder. 因此,为了修复我的服务器构建,我只需要编辑我的
csproj
文件,将新的(并更新像Newtonsoft
)软件包重定向到联结文件夹。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.