开发者

Why is my project reference working without issue but as soon as I build the solution the reference fails?

开发者 https://www.devze.com 2023-03-14 22:17 出处:网络
I have multiple projects under one solution. I add a reference to Project A from Project B. Now I can add \'using ProjectA.Models;\' (intellisense works!) to classes in Project B b开发者_JAVA技巧ecaus

I have multiple projects under one solution. I add a reference to Project A from Project B. Now I can add 'using ProjectA.Models;' (intellisense works!) to classes in Project B b开发者_JAVA技巧ecause it now has the reference, and the keyword coloring for custom objects works, the autocomplete/intellisense all works fine...

Right until I build my solution. Suddenly I get a reference failure, the 'using' line that I added becomes underlined with red, and all the object references lose their keyword coloring.

I can repeat the process indefinitely by removing and recreating the reference, which allows the IDE to be fine with 'using ProjectA;' and all intellisense, right up until I hit build again.

What is causing this?

Update: Holy crap this is driving me nuts, I can't find ANYTHING to explain this!! I add the project reference and then go to the code and start typing:

using P

now suddenly auto complete shows the rest of it ProjectA{}

and I can keep going and add .Models{} and it will auto complete that as well.

As SOON as I hit Build for the entire Solution OR just the project, suddenly I get an error:

Type or namespace could not be found...

At this point if I go up to the code again and start typing:

using P

NO AUTO COMPLETE, it can no longer find the reference anymore... WTF.

I am going to throw this machine out the window.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号