[英]DLL Hell with .net core and .net (Azure WebJobs)
So, I have a WebJob project that needed updating. 因此,我有一个需要更新的WebJob项目。 I was running into DLL issues which was solved by this post:
我遇到了DLL问题,此问题已解决:
https://github.com/Azure/azure-webjobs-sdk/issues/1633 https://github.com/Azure/azure-webjobs-sdk/issues/1633
The last comment states: 最后一条评论指出:
I would recommend folks use the more recent versions:
我建议人们使用更新的版本:
Microsoft.Azure.WebJobs (2.2.0)
Microsoft.Azure.WebJobs(2.2.0)
Microsoft.NET.Sdk.Functions (1.0.21)
Microsoft.NET.Sdk.Functions(1.0.21)
Newtonsoft.Json (9.0.1)
Newtonsoft.Json(9.0.1)
So that is what I did and my WebJob compiles. 这就是我所做的,并且我的WebJob进行了编译。 Great.
大。 Or so I thought.
还是我想。 It turns out that my shared DLL uses the latest version of Newtonsoft's Json.Net (12.0.1) which is now throwing an error when I run my WebJob.
事实证明,我的共享DLL使用Newtonsoft的Json.Net(12.0.1)的最新版本,当我运行WebJob时现在抛出错误。
This is the error I am getting: 这是我得到的错误:
A ScriptHost error has occurred [29/11/2018 10:17:08] Cormar.Extensions: Could not load file or assembly 'Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies.
发生ScriptHost错误[29/11/2018 10:17:08] Cormar.Extensions:无法加载文件或程序集“ Newtonsoft.Json,版本= 11.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed”或其中之一依赖。 The system cannot find the file specified.
该系统找不到指定的文件。 [29/11/2018 10:17:08] Could not load file or assembly 'Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies.
[29/11/2018 10:17:08]无法加载文件或程序集“ Newtonsoft.Json,版本= 11.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed”或其依赖项之一。 The system cannot find the file specified.
该系统找不到指定的文件。 [29/11/2018 10:17:08] Cormar.Extensions: Could not load file or assembly 'Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies.
[29/11/2018 10:17:08] Cormar.Extensions:无法加载文件或程序集“ Newtonsoft.Json,版本= 11.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed”或其依赖项之一。 The system cannot find the file specified.
该系统找不到指定的文件。
Does anyone know how I can get around this? 有人知道我该如何解决吗?
I managed to fix this. 我设法解决了这个问题。 I did what the post said and set my nuget package version to:
我按照帖子所说的做了,并将我的nuget软件包版本设置为:
And then I just edited the WebJob .csproj file and changed the Nuget PackageReference to this: 然后,我只是编辑了WebJob .csproj文件,并将Nuget PackageReference更改为:
<PackageReference Include="Newtonsoft.Json" Version="11.0.0.0" />
And it worked. 而且有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.