Wrong version of System.Runtime being packaged

这一生的挚爱 提交于 2019-12-12 03:04:19

问题


We have written a service to be deployed to Azure. This consists of a DLL with a "Worker Role" class, and an Azure Cloud Service project, as shown below:

The build steps are:

  1. Build the ccproj in "Release" configuration.
  2. Run NuGet "spec", then "pack" to get a .nupkg file
  3. Deploy the .nupkg file to the Azure Cloud Service

This has been working fine for a while, until we upgraded to .NET 4.6.2 and also upgraded several other references, including System.Runtime (now v4.3.1). Now, despite the fact that we have (probably unnecessarily) added a NuGet reference to every single project in the solution, pointing to System.Runtime 4.3.1, the version of System.Runtime.dll that gets deployed is an older version, resulting in DLL hell on the service, which then fails to run. If we manually copy over the correct version of System.Runtime.dll, then everything works again.

Where is this incorrect version of System.Runtime coming from? And how do we convince the offending software/hardware to use the correct version?

UPDATE: Trail is getting warmer. On my development machine, the bin folder of the EventWorker project contains the correct version of System.Runtime.dll. But... the EventProcessor\obj\debug\EventWorker folder contains the old version! I deleted the obj folder and recompiled the project - and the old version of the DLL appears again.

Where is it coming from, and how to fix?


回答1:


You have the right idea in terms of hunting down the offending DLL. Have you any dependent DLL's which could be using the wrong version? Also, when run locally does it give you the dll conflict warning in the errors window, allowing you to identify where? Take a look at your config file and see if you have a reference to the DLL version in the redirects section, update it or create a new one to point at the latest version.




回答2:


Well, I fixed it, but I'm not sure why this worked. I removed the NuGet reference to System.Runtime from the EventWorker project. And now the EventProcessorRole is using the correct version of the DLL.

I'll mark this as the answer in the meantime, but if anyone can provide an explanation for this behavior, I'll give you answer credit...



来源:https://stackoverflow.com/questions/40572793/wrong-version-of-system-runtime-being-packaged

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!