调试/构建时引用消失(C#、VB.NET、VS2010)
我正在将 MagicLibrary
用于一些组件。我知道它是用 Visual Studio 2003 编写的,并在 Visual C# Express 2010 中重新编译它。它编译得很好,我可以在文件夹中看到该库。
然后,我在 Visual C# Express 2010 中创建了一个新项目,并将组件 MagicalLocalLibrary.dll
添加到工具箱。他们看起来很好,没有错误。我将工具箱中的控件放入表单中,看起来不错。然后我进行了调试(以查看是否会发生任何错误),我看到引用 MagicalLibrary
消失了,并且收到了错误:
The type or namespace name 'Crownwood' could not be found (are you missing a using directive or an assembly reference?)
问题是,该引用在解决方案资源管理器中的“引用”下显示正常,但我可以不使用 using
导入它或在代码中使用它(也不会在 InstelliSense 中列出),但如果我进入对象浏览器并选择“我的解决方案”,它不会列出。我可以单击“解决方案资源管理器”中的“引用”,只需将“复制本地”属性更改为 True 或 False,然后它将出现在对象浏览器中,但每当我再次调试项目时,它就会消失。
知道为什么这样做吗?提前致谢。
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.
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?)
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
检查您是否使用 .Net 4 框架而不是客户端配置文件版本。
当您右键单击项目并选择属性时,您会发现该设置。在应用程序下有一个目标框架的设置。如果您选择了.Net 4框架客户端配置文件,那么您描述的这种行为可能会发生
Check that you are using the .Net 4 framework and not the client profile version
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
我曾经遇到过一个非常类似的问题。就我而言,问题在于“消失”的命名空间程序集缺少依赖项。最终为我提供了所需信息的是 此 StackOverflow 答案可提高 MSBuild 输出详细级别。提高详细程度设置后,IDE 应该为您提供编译失败的更具体原因。
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. After raising the verbosity setting the IDE should give you a more specific reason why the compilation fails.