Visual Studio 2017(15.5.4)的生成日志让我很困惑如何摆脱警告
发现无法解决的“ Microsoft.WindowsAzure.Storage”不同版本之间的冲突。将日志详细程度设置为“详细”时,这些参考冲突会在构建日志中列出。Animals.Swine.Functions C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Enterprise \ MSBuild \ 15.0 \ Bin \ Microsoft.Common.CurrentVersion.targets
There was a conflict between "Microsoft.WindowsAzure.Storage, Version=7.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" and "Microsoft.WindowsAzure.Storage, Version=8.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35".
"Microsoft.WindowsAzure.Storage, Version=7.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was chosen because it was primary and "Microsoft.WindowsAzure.Storage, Version=8.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was not.
References which depend on "Microsoft.WindowsAzure.Storage, Version=7.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" [D:\Repos\Animals\src\Animals.Swine\packages\WindowsAzure.Storage.7.2.1\lib\net40\Microsoft.WindowsAzure.Storage.dll].
D:\Repos\Animals\src\Animals.Swine\packages\WindowsAzure.Storage.7.2.1\lib\net40\Microsoft.WindowsAzure.Storage.dll
Project file item includes which caused reference "D:\Repos\Animals\src\Animals.Swine\packages\WindowsAzure.Storage.7.2.1\lib\net40\Microsoft.WindowsAzure.Storage.dll".
Microsoft.WindowsAzure.Storage, Version=7.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL
References which depend on "Microsoft.WindowsAzure.Storage, Version=8.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" [].
D:\Repos\Animals\src\Animals.Common\Animals.Common.Functions\bin\Debug\net461\bin\Animals.Common.Functions.dll
Project file item includes which caused reference "D:\Repos\Animals\src\Animals.Common\Animals.Common.Functions\bin\Debug\net461\bin\Animals.Common.Functions.dll".
D:\Repos\Animals\src\Animals.Common\Animals.Common.Functions\bin\Debug\net461\bin\Animals.Common.Functions.dll
D:\Repos\Animals\src\packages\Microsoft.Azure.WebJobs.2.1.0\lib\net45\Microsoft.Azure.WebJobs.Host.dll
Project file item includes which caused reference "D:\Repos\Animals\src\packages\Microsoft.Azure.WebJobs.2.1.0\lib\net45\Microsoft.Azure.WebJobs.Host.dll".
Microsoft.Azure.WebJobs.Host, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL
Microsoft.Azure.WebJobs.Extensions, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL
D:\Repos\Animals\src\Animals.Common\Animals.Common\bin\Debug\net45\Animals.Common.dll
Project file item includes which caused reference "D:\Repos\Animals\src\Animals.Common\Animals.Common\bin\Debug\net45\Animals.Common.dll".
D:\Repos\Animals\src\Animals.Swine\Animals.Swine\bin\Debug\Animals.Swine.dll
D:\Repos\Animals\src\Animals.Common\Animals.Common\bin\Debug\net45\Animals.Common.dll
D:\Repos\Animals\src\Animals.Swine\packages\Microsoft.Azure.WebJobs.Extensions.2.0.0\lib\net45\Microsoft.Azure.WebJobs.Extensions.dll
Project file item includes which caused reference "D:\Repos\Animals\src\Animals.Swine\packages\Microsoft.Azure.WebJobs.Extensions.2.0.0\lib\net45\Microsoft.Azure.WebJobs.Extensions.dll".
Microsoft.Azure.WebJobs.Extensions, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL
如果我们遍历据说使用Storage 8.1.1.0的引用,我们会看到第一个,第三个和最后一个看起来都是引用自身。为什么会这样呢?那有什么意思?
D:\Repos\Animals\src\Animals.Common\Animals.Common.Functions\bin\Debug\net461\bin\Animals.Common.Functions.dll
Project file item includes which caused reference "D:\Repos\Animals\src\Animals.Common\Animals.Common.Functions\bin\Debug\net461\bin\Animals.Common.Functions.dll".
D:\Repos\Animals\src\Animals.Common\Animals.Common.Functions\bin\Debug\net461\bin\Animals.Common.Functions.dll
...
D:\Repos\Animals\src\Animals.Common\Animals.Common\bin\Debug\net45\Animals.Common.dll
Project file item includes which caused reference "D:\Repos\Animals\src\Animals.Common\Animals.Common\bin\Debug\net45\Animals.Common.dll".
D:\Repos\Animals\src\Animals.Swine\Animals.Swine\bin\Debug\Animals.Swine.dll
D:\Repos\Animals\src\Animals.Common\Animals.Common\bin\Debug\net45\Animals.Common.dll
D:\Repos\Animals\src\Animals.Swine\packages\Microsoft.Azure.WebJobs.Extensions.2.0.0\lib\net45\Microsoft.Azure.WebJobs.Extensions.dll
Project file item includes which caused reference "D:\Repos\Animals\src\Animals.Swine\packages\Microsoft.Azure.WebJobs.Extensions.2.0.0\lib\net45\Microsoft.Azure.WebJobs.Extensions.dll".
Microsoft.Azure.WebJobs.Extensions, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL
第二个似乎更适合检查和讨论:
D:\Repos\Animals\src\packages\Microsoft.Azure.WebJobs.2.1.0\lib\net45\Microsoft.Azure.WebJobs.Host.dll
Project file item includes which caused reference "D:\Repos\Animals\src\packages\Microsoft.Azure.WebJobs.2.1.0\lib\net45\Microsoft.Azure.WebJobs.Host.dll".
Microsoft.Azure.WebJobs.Host, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL
Microsoft.Azure.WebJobs.Extensions, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL
因此,如果我没看错,Microsoft.Azure.WebJobs.Host, Version=2.1.0.0
并且Microsoft.Azure.WebJobs.Extensions, Version=2.0.0.0
都应该引用Microsoft.WindowsAzure.Storage, Version=8.1.1.0
。但是,如果我们看一下Nuget依赖项,WebJobs引用7.2.1.0
和WebJobs.Extensions只是引用回到[WebJobs]。
我没有看到任何引用8.1.1.0
!任何项目都没有直接引用存储,因此我看不到任何间接引用。
我已经在“ D:\ Repos \ Animals \ src \ Animals.Swine \ Animals.Swine.Functions \ bin \”上运行AsmSpy,但它甚至没有显示出与存储的冲突。
如何确定Storage 8.1.1.0参考的来源?
更新:我进行了文本搜索,发现绑定重定向设置为“ 8.1.1.0”作为newVersion。我将其更改为“ 7.2.1.0”,警告消失了。甚至认为警告已经消失,我还是悬而未决,以便有人可以提供有关如何读取构建日志以及日志如何向我们指示正确方向的见解。
如何确定Storage 8.1.1.0参考的来源?
构建日志可以帮助我们解决大多数问题,但不能解决所有问题。仍然需要我们手动解决这些问题。因为Visual Studio / MSBuild不能聪明地直接找到问题的根本原因。
遇到此MSB3247 / MSB3277错误时,解决此问题的最佳方法是将MSBuild输出日志转到诊断(工具->选项->项目和解决方案->生成并运行,设置MSBuild项目生成输出详细程度),然后找到依赖于的引用Microsoft.WindowsAzure.Storage
,请检查Microsoft.WindowsAzure.Storage
引用的版本是否不同。
在构建日志中,我们发现Project文件项包括引起引用的项目Microsoft.Azure.WebJobs.2.1.0
和Microsoft.Azure.WebJobs.Extensions.2.0.0
然后检查这两个软件包的依赖关系,它们都没有引用Microsoft.WindowsAzure.Storage, Version=8.1.1.0
。
为了确认这一点,您可以使用弗拉基米尔(Vladimir)在注释中提供的方法。
目前,此冲突不应来自引用。然后我们应该检查与参考版本相关的文件,例如app.confi
g或web.config
,找到有关reference的绑定重定向Microsoft.WindowsAzure.Storage
,检查绑定重定向是否正确。
因此,有时我们不能仅根据构建日志信息直接解决问题,手动故障排除也必不可少。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句