ASPNET Core RC2之前的依赖关系含糊不清

编程入门 行业动态 更新时间:2024-10-07 10:16:49
本文介绍了ASPNET Core RC2之前的依赖关系含糊不清的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用:

.NET Command Line Tools (1.0.0-rc2-002439) Product Information: Version: 1.0.0-rc2-002439 Commit Sha: ef0c3b2cee Runtime Environment: OS Name: Windows OS Version: 10.0.10586 OS Platform: Windows RID: win10-x64

并获得:

错误CS0121:以下方法或属性之间的调用不明确:'Microsoft.Extensions.DependencyInjection.OptionsServiceCollectionExtensions.Configure(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.Action)'和'Microsoft.Extensions.DependencyInjection.OptionsServiceCollectionExtensions .Configure(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.Action)'

error CS0121: The call is ambiguous between the following methods or properties: 'Microsoft.Extensions.DependencyInjection.OptionsServiceCollectionExtensions.Configure(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Action)' and 'Microsoft.Extensions.DependencyInjection.OptionsServiceCollectionExtensions.Configure(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Action)'

我怀疑"dotnet restore"中包含多个OptionModel程序集(不同版本).

I suspect there are multiple OptionsModel assemblies (different versions) included on "dotnet restore".

证明可能在这里:

第二个建议使用不同的参数名称:

The second suggestion with different parameter name:

Project.lock.json文件有几行有趣的内容("Infrastructure"是引用的程序集):

Project.lock.json file has few interesting lines ("Infrastructure" is a referenced assembly):

"Infrastructure/1.0.0": { "type": "project", "framework": ".NETFramework,Version=v4.6.1", "dependencies": { "Domain": "1.0.0", "Microsoft.Extensions.Caching.Abstractions": "1.0.0", "Microsoft.Extensions.OptionsModel": "1.0.0", "Newtonsoft.Json": "8.0.3", "WindowsAzure.Storage": "6.2.1" }, "compile": { "net461/Infrastructure.dll": {} }, "runtime": { "net461/Infrastructure.dll": {} } }

当Web应用程序使用Microsoft.Extensions.OptionsModel/1.0.0-rc2-15914

while the web application uses Microsoft.Extensions.OptionsModel/1.0.0-rc2-15914

这是基础结构程序集的配置部分:

Here is the configuration section of Infrastructure assembly:

"dependencies": { "Domain": "1.0.0-*", "Microsoft.Extensions.Caching.Abstractions": "1.0.0-*", "Microsoft.Extensions.OptionsModel": "1.0.0-*", "Newtonsoft.Json": "8.0.3", "WindowsAzure.Storage": "6.2.1-*" }

问题是:为什么在执行"dotnet restore"时选择了不同的版本(1.0.0和1.0.0-rc2-15914)?

The question is: why different versions (1.0.0 and 1.0.0-rc2-15914) are chosen while executing "dotnet restore"?

更新:我尝试将基础结构项目的project.json更改为"Microsoft.Extensions.OptionsModel":"1.0.0-rc2-15914",但由于屏幕截图中显示的歧义性,我仍然无法编译.是否有任何程序集缓存在我的计算机上的某个地方?

UPDATE: I tried changing project.json of Infrastructure project to "Microsoft.Extensions.OptionsModel": "1.0.0-rc2-15914" but I am still can't compile because of ambiguity displayed in screenshots. Are any assemblies cached somewhere on my computer?

推荐答案

解决方案是:

Microsoft.Extensions.Options 而不是Microsoft.Extensions.OptionsModel包.

Microsoft.Extensions.Options instead of Microsoft.Extensions.OptionsModel package had to be used in a referenced project.

更多推荐

ASPNET Core RC2之前的依赖关系含糊不清

本文发布于:2023-11-26 10:19:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1633681.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不清   关系   ASPNET   Core

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!