Mysterious disappearing reference

北城余情 提交于 2019-12-04 04:23:32

问题


I have what seems to be a very strange problem with a windows forms application. I am a web developer and I have limited experience of developing windows forms application. I am working on an ecommerce web site which stores product images in the database as blobs. In order to make it easier to bulk import images I am writing a small windows forms utility that uses the existing website bll library. I am using Visual studio 2010 c# and .net 4. I created a new windows forms project in my solution and added a reference to the bll project. I started coding and added using statements to my code, everything was working as expected intelisense worked corectly with my bll classes etc. Then i built the project and it failed, it complained about every line of code that refered to anything from the bll project including the using statements, and intelisense no longer worked for anything from the bll project. Basically what you would expect if there were no reference to the bll project. If i remove the reference and then re add it, or add ar reference to another projecct in the solution, intelisense comes back and all of the compiler errors disapear. Then if i build again they all reappear and intelisense no longer works.

What am i missing, what the hell might be going on here.


回答1:


Your library possibly has dependencies on other .NET libraries such as System.Web that you need to reference in your Forms app. That can create this sort of behaviour.




回答2:


I just recently had an issue like this one, and wanted to include my solution for future reference in case it comes up again. There's a warning (not an error) message that pops up when the build fails, which I missed originally because I had my error list set to filter warnings out. In my particular case I needed to change away from using the client version of .NET, and the warning message contained the information I needed to debug the problem.

Warning 44 The referenced assembly [...] could not be resolved because it has a dependency on [...] which is not in the currently targeted framework [...]. Please remove references to assemblies not in the targeted framework or consider retargeting your project. [...]"



来源:https://stackoverflow.com/questions/5961775/mysterious-disappearing-reference

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!