Why can't I reference my class library?

后端 未结 20 1874
隐瞒了意图╮
隐瞒了意图╮ 2020-12-08 12:38

I have a solution that contains a website and a class library in Visual Studio 2008.

I then have another web site project outside of the solution that needs to refe

20条回答
  •  Happy的楠姐
    2020-12-08 13:17

    I had a similar issue in VS 2010, when creating a test project for an MVC 2 application. The symptoms were identical.

    The message from ReSharper was somewhat misleading. For a moment I completely ignored ReSharper and did it the "manual VS way":

    1. I cleaned the solution.
    2. I manually added the reference to the MVC project.
    3. I manually added the using directives.
    4. ctrl-shift-b

    At this stage I got a compilation error: I should have referenced the System.Web.Mvc assembly in my test project (sigh). Adding this reference causes the project to compile. The ReSharper issues remain, but the ReSharper test runner works.

    When I restart VS, the ReSharper errors are gone too. I'm not sure if the restart is required - simply closing the .cs file might be enough.

    From now on, when I see the ReSharper message

    Failed to reference module. Probably, reference will produce circular dependencies between projects.

    I'll read

    Failed to reference module. Probably, reference will produce circular dependencies between projects, or you are missing some references to dependencies of the reference's dependencies.

提交回复
热议问题