为什么VS2010会“输”?我的构建参考?

发布于 2024-09-04 19:34:08 字数 377 浏览 1 评论 0原文

我开发了一个可以做一些事情的类库,并通过单元测试对其进行了测试。库和测试构建并运行良好。然后,我将一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

心作怪 2024-09-11 19:34:08

事实证明,如果您在“构建”窗口中显示警告,它会告诉您原因:) 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.

客…行舟 2024-09-11 19:34:08

当目标.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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文