为什么VS2010会“输”?我的构建参考?
我开发了一个可以做一些事情的类库,并通过单元测试对其进行了测试。库和测试构建并运行良好。然后,我将一个 Windows 服务项目添加到解决方案中以将库包装起来。
我添加了对我的类项目的引用,添加了一条 using 语句,并从类库中添加了一个对象。它的颜色编码很好,重构可以按住 Ctrl 键单击并导航到它,但是当我构建项目/解决方案时,它声称 my 的类型未知,并且有一个例外:
类型或命名空间名称 “EmailLoaderCore”不存在于 命名空间“MPN.Apollo”(您是 缺少程序集引用?)
这对我来说没有意义。我尝试删除引用、清理解决方案、重新创建引用,但没有任何乐趣。是我做错了什么还是VS2010很奇怪?
I've developed a class library that does stuff, and tested it with unit tests. The library and tests build and work fine. I then added in a Windows Service project to the solution to wrap the library up in.
I've added a reference to my class project, added a using statement and var'd an object from the class lib. It colour-codes just fine and Refactor can ctrl-click and navigate into it, but when I build the project/solution, it claims the type of my is unknown and there's an exception:
The type or namespace name
'EmailLoaderCore' does not exist in
the namespace 'MPN.Apollo' (are you
missing an assembly reference?)
This doesn't make sense to me. I've tried removing the reference, cleaning the solution, re-creating the reference, but no joy. Am I doing something wrong or is VS2010 being weird?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
事实证明,如果您在“构建”窗口中显示警告,它会告诉您原因:) Doh。
服务项目现在默认为“Framework 4 Client Profile”,这是 Framework 4 的子集,这意味着除此之外没有任何其他链接。将项目类型更改为 Framework 4,一切都很好。
Turns out, if you show the Warnings in the Build window, it tells you why :) Doh.
Service projects default to "Framework 4 Client Profile" now, and that is a sub-set of Framework 4 which means no linking to anything else other than that. Changed the project type to Framework 4 and all is good.
当目标.Net Framework(在项目设置下)存在差异时,将会产生引用丢失问题。它会产生奇怪的问题,例如当我添加引用时它会被添加。但是当我构建时,它会再次丢失引用。使两个项目的目标框架工作相同后解决了该错误。
When there is a difference in Target .Net Framework(under project settings), it will create reference missing problems. It creates strange problems like when i add the reference it gets added. But when i build, again it will loose the reference. After making Target frame work same for both the project resolved the error.