调试我认为是伪造的 VS2010 错误(缺少程序集引用)
我之前已经这样做了数百次,没有任何问题,但今天我有一个项目在 VS2010 中无法配合。
我有一个插件,需要测试它。所以我编写了一个测试应用程序来托管我的插件。每当我这样做时,我只需添加对插件的引用,然后在我的代码中声明它。由于测试应用程序默认没有添加 using 语句,因此我将鼠标悬停在类型上,然后按 Shift-Alt-F10 并按 Enter 键以自动生成 using 语句。直到今天我才遇到过这样的失败。
我遇到的问题是,我第一次这样做时,它添加了语句很好,但是当我编译时,我收到错误:
无法找到命名空间名称“Company”的类型(您是否缺少使用指令还是程序集引用?)。
不,我不是。就在那里和那里。但现在我的插件有红色下划线,好像有问题。
如果我关闭 VS2010 并重新打开该项目,它将打开并且插件的类型正确地以蓝色突出显示。但是当我编译时,我再次收到错误,然后再次出现红色下划线。
这简直让我抓狂。我希望有人以前见过这个,或者可以指出我做错了什么愚蠢的事情!
I've done this hundreds of times before without issue, but today I've got a project that just won't cooperate in VS2010.
I have a plugin and need to test it. So I wrote a test application that will host my plugin. Whenever I do this, I just add a reference to the plugin, then declare it in my code. Since the test app doesn't have the using statement added by default, I hover over the type and press Shift-Alt-F10 and hit enter to automatically generate the using statement. I've never had this fail until today.
The problem I have is that the first time I do it, it adds the statement fine, but then when I compile I get the error:
The type of namespace name 'Company' could not be found (are you missing a using directive or an assembly reference?).
No, I'm not. It's right there and there. But now my plugin is underlined in red as if there's a problem.
If I close VS2010 and reopen the project, it opens and the plugin's type is correctly highlighted in blue. But when I compile, I get the error again and then get the red underlining again.
This is totally driving me batty. I'm hoping that someone has seen this before, or can point out what stupid thing I'm doing wrong!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
废话。我决定查看测试应用程序项目属性,并将我的 .NET 目标框架设置为 4.0 而不是 4.0 CP。这解决了我的问题。啊!
Crap. I decided to look into the test app project properties, and set my .NET target framework to 4.0 instead of 4.0 CP. That fixed my problem. Argh!