简体   繁体   中英

Library reference imports ok, intellisense sees everything, objects instatiated… then I build and it can't find anything?

I run into this every once in a while and I never really figured out how to fix it. I have a class library that is in the same solution as the test console project. when I add a reference to the library in the console project and add the using statement, intellisense sees all of the classes just fine. So I write some code and use those classes. All of the class members are showing just fine. Then I hit build. I get an error that the classes from the library cannot be found (are you missing a using directive or an assembly reference?). Now all of a sudden, all my objects are underlined in red and no longer color coded as classes, and the using statement is also underlined in red. The reference to the library is still in the references folder. Wtf

If I remove the reference and readd it, its the same thing. It'll see everything just fine until i build.

在此处输入图片说明

Check that warning in your screen, saying " Referenced assembly UTILibrary could not be resolved because it has dependency on System.Web.... ". UTILibrary is probably using System.Web internally, so this dependency must also be added to TestConsole project.

Add it and all should be fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM