调试/构建时引用消失(C#、VB.NET、VS2010) [英] Reference disappear upon debug/build (C#, VB.NET, VS2010)

查看:13
本文介绍了调试/构建时引用消失(C#、VB.NET、VS2010)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 MagicLibrary 用于一些组件.我知道它是用 Visual Studio 2003 编写的,然后在 Visual C# Express 2010 中重新编译.它编译得很好,我可以在文件夹中看到库.

I am using the MagicLibrary for a few components. I knew it was written in Visual Studio 2003 and recompiled it in Visual C# Express 2010. It compiled just fine and I could see the library in the folder.

然后我在 Visual C# Express 2010 中创建了一个新项目并将组件 MagicalLocalLibrary.dll 添加到工具箱.他们看起来很好,没有错误.我将工具箱中的控件放入我的表单中,看起来不错.然后我调试了(看看是否会发生任何错误),我看到参考 MagicalLibrary 消失了,我得到了错误:

I then created a new project in Visual C# Express 2010 and added the components MagicalLocalLibrary.dll to the Toolbox. They appeared fine with no errors. I put in a control from the Toolbox to my form, and it seemed fine. I then debugged (to see if any errors would occur) and I saw that the reference MagicalLibrary disappeared and I got the error:

The type or namespace name 'Crownwood' could not be found (are you missing a using directive or an assembly reference?)

问题是,参考在解决方案资源管理器中的参考下显示良好,但我无法使用 using 导入它或在代码中使用它(也没有在 InstelliSense 中列出)但是如果我进入对象浏览器并选择未列出的我的解决方案".我可以单击解决方案资源管理器中的引用,然后将复制本地属性更改为 True 或 False,然后它就会出现在对象浏览器中,但是每当我再次调试我的项目时,它就会消失.

The thing is that, the reference shows fine under References in Solution Explorer but I can't import it with using or use it in the code (simply is not listed in InstelliSense either) but if i go into the Object Browser and choose "My Solution" it is not listed. I can click on the Reference in Solution Explorer and just change the Copy Local property to True or False, then it will appear in the Object Browser but whenever I debug my project again it disappear.

知道为什么要这样做吗?提前致谢.

Any idea why it does this? Thanks in advance.

推荐答案

检查您使用的是 .Net 4 框架而不是客户端配置文件版本

Check that you are using the .Net 4 framework and not the client profile version

当您右键单击您的项目时,您会发现该设置,选择属性.在应用程序下有一个目标框架的设置.如果您选择了 .Net 4 框架客户端配置文件,那么您描述的这种行为可能会发生

You find that setting when you right-click on your project, choose properties. And under application there is a setting for target framework. If you have chosen the .Net 4 framework Client Profile, then this behavior that you described can happen

这篇关于调试/构建时引用消失(C#、VB.NET、VS2010)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆