简体   繁体   English

引用在调试/构建时消失(C#,VB.NET,VS2010)

[英]Reference disappear upon debug/build (C#, VB.NET, VS2010)

I am using the MagicLibrary for a few components. 我正在将MagicLibrary用于一些组件。 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 Studio 2003编写的,并在Visual C#Express 2010中重新编译的。它编译得很好,我可以在文件夹中看到该库。

I then created a new project in Visual C# Express 2010 and added the components MagicalLocalLibrary.dll to the Toolbox. 然后,我在Visual C#Express 2010中创建了一个新项目,并将组件MagicalLocalLibrary.dll添加到了“工具箱”中。 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: 然后,我进行了调试(看看是否会发生任何错误),然后看到参考MagicalLibrary消失了,并且出现了错误:

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

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. 问题是,按照在Solution Explorer引用参考表演不错,但我不能导入using或代码(简单地说就是不InstelliSense上市或者)使用它,但如果我去到对象浏览器,然后选择“我的解决方案”中未列出。 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. 我可以在解决方案资源管理器中单击“引用”,然后将“复制本地”属性更改为True或False,然后它将出现在对象浏览器中,但是每当我再次调试项目时,它就会消失。

Any idea why it does this? 知道为什么这样做吗? Thanks in advance. 提前致谢。

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 如果您选择了.Net 4框架客户端配置文件,则您描述的此行为可能会发生

I ran into a very similar issue once. 我曾经遇到过一个非常相似的问题。 In my case the problem turned out to be a missing dependency for the "vanishing" namespace's assembly. 在我的情况下,问题原来是缺少“消失的”名称空间程序集的依赖项。 What finally gave me the information I needed was the suggestion in this StackOverflow answer to raise the MSBuild output verbosity level. 最终为我提供了所需信息的是这个 StackOverflow答案中的建议,以提高MSBuild输出的详细程度。 After raising the verbosity setting the IDE should give you a more specific reason why the compilation fails. 提高详细设置后,IDE应该为您提供编译失败的更具体原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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