Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 3 MVC Visual Studio“;循环依赖性“;_Asp.net Mvc 3_Visual Studio 2010_Circular Dependency - Fatal编程技术网

Asp.net mvc 3 MVC Visual Studio“;循环依赖性“;

Asp.net mvc 3 MVC Visual Studio“;循环依赖性“;,asp.net-mvc-3,visual-studio-2010,circular-dependency,Asp.net Mvc 3,Visual Studio 2010,Circular Dependency,目前我对“循环依赖”有一个问题。我出现错误,因为我必须将文件.dll添加到另一个项目中,但要添加的项目中已存在引用。我不知道我该怎么办 Error 1 SportsStore.WebUI.accessor: The reference to 'SportsStore.WebUI.dll' was not found in the list of this projects references SportsStore.UnitTests 通过查看您刚刚发布的屏幕截图,看起来您正在添加

目前我对“循环依赖”有一个问题。我出现错误,因为我必须将文件.dll添加到另一个项目中,但要添加的项目中已存在引用。我不知道我该怎么办

Error   1   SportsStore.WebUI.accessor: The reference to 'SportsStore.WebUI.dll' was not found in the list of this projects references  SportsStore.UnitTests

通过查看您刚刚发布的屏幕截图,看起来您正在添加SportsStore.WebUI项目作为对SportsStore.UnitTests的引用,但由于循环依赖性,此操作失败。这是否意味着您的WebUI项目已经引用了UnitTests项目?如果是这样,那么您的设计就有问题了,因为“真实”代码永远不应该引用测试项目


现在,一般来说,如果要解决循环依赖关系,只需在单独的部件中提取公共零件即可。项目不会相互引用,而是引用该公共程序集。

因此,在UnitTests程序集中有对WebUI程序集的引用,但为什么要从WebUI程序集中引用UnitTests程序集呢?