VS2010为什么会“丢失”?我对构建的参考? [英] Why Does VS2010 "Lose" my reference on build?

查看:102
本文介绍了VS2010为什么会“丢失”?我对构建的参考?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发了一个可以填充内容的类库,并已通过单元测试对其进行了测试。库和测试可以正常运行。然后,我在解决方案中添加了Windows Service项目,以将库包装起来。

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.

我添加了对类项目的引用,添加了using语句和var是来自类lib的对象。它的颜色代码很好,Refactor可以按Ctrl键单击并导航到其中,但是当我构建项目/解决方案时,它声称我的类型未知,并且有一个例外:

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:


类型或名称空间名称
'EmailLoaderCore'在
名称空间'MPN.Apollo'中不存在(您
是否缺少程序集引用? )

The type or namespace name 'EmailLoaderCore' does not exist in the namespace 'MPN.Apollo' (are you missing an assembly reference?)

这对我来说没有意义。我尝试删除参考,清理解决方案,重新创建参考,但没有任何乐趣。是我做错了还是VS2010很奇怪?

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?

推荐答案

结果是,如果在生成窗口中显示警告,它将告诉你为什么:) Doh。

Turns out, if you show the Warnings in the Build window, it tells you why :) Doh.

服务项目现在默认为 Framework 4 Client Profile,这是Framework 4的子集,意味着没有链接到任何东西除此之外。将项目类型更改为Framework 4,一切都很好。

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.

这篇关于VS2010为什么会“丢失”?我对构建的参考?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆