Why can't I reference my class library?

后端 未结 20 1852
隐瞒了意图╮
隐瞒了意图╮ 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条回答
  •  伪装坚强ぢ
    2020-12-08 13:26

    I had stumbled upon a similar issue recently. I am working in Visual Studio 2015 with Resharper Ultimate 2016.1.2. I was trying to add a new class to my code base while trying to reference a class from another assembly but Resharper would throw an error for that package.

    With some help of a co-worker, I figured out that the referenced class existed in the global namespace and wasn't accessible from the new class since it was hidden by another entity of same name that existed in current namespace.

    Adding a 'global::' keyword before the required namespace helped me to reference the class I was actually looking for. More details on this can be found on the page listed below:

    https://msdn.microsoft.com/en-us/library/c3ay4x3d.aspx

提交回复
热议问题