Dnx 4.5.1/Dnx Core 5.0 Ambiguous reference

感情迁移 提交于 2019-12-23 12:39:34

问题


In many projects that I and others I have there is an Ambiguous reference error that pops up if i use an object that is apart of a different asp.net5 project. Funny enough it still compiles and works but there is no intellisense and my code is covered in red lines.

An example of this is I have a Tests project pointing to my MVC project. When i try to create a new instance of XController, it will show an error that it doesnt know which XController to use the DNX 4.5.1 or DNX 5.0. I am aware of what those are but it wont let me choose, even though I feel like I shouldnt. Again, it works, just frustrating.

The only way I can get this to work is if I choose only one framework for my MVC project. I dont like doing this because I want to know if dnxcore50 doesnt support something that I am writing in the MVC app. I tried only using one framework in the unit test project but that did not work.

I want to be clear that I do understand that asp.net 5 stuff is in beta and there are many bugs. I am wondering if this is a a bug or if I am just doing something wrong.

Update 1: It seems the problem only occurs if I have a new Asp.Net 5 Class library referencing a Asp.Net 5 Mvc project. Library to library works and mvc to library also works.


回答1:


After spending some time talking to the guys involved with the Asp.net 5 development team, we've come to the conclusion that this was, in my case certainly, a ReSharper issue.

If you switch off ReSharper the errors disappear.

Thanks




回答2:


Looks like the solution is to only use one framework when referencing an MVC Project from another project. Seems to be just a bug.



来源:https://stackoverflow.com/questions/30877165/dnx-4-5-1-dnx-core-5-0-ambiguous-reference

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