随机集引用失败("是否缺少using指令或程序集引用"?) [英] Random assembly references fail ("Are you missing a using directive or an assembly reference?")

查看:212
本文介绍了随机集引用失败("是否缺少using指令或程序集引用"?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序具有3.5和4.0定位组件的混合物。我工作的一个新的Windows服务,瞄准4.0和项目似乎突然无法看到一些在解决方案中的其他组件。这意味着,在构建,这些某些其他组件的所有引用产生以下错误:

My application has a mixture of 3.5 and 4.0-targeted assemblies. I'm working on a new Windows service targeting 4.0 and the project suddenly seems unable to see some of the other assemblies in the solution. Meaning, on build, all references to these certain other assemblies produce the following error:

中的类型或命名空间名称[X]在命名空间中不存在'[Y](是否缺少程序集引用?)

The type or namespace name '[X]' does not exist in the namespace '[Y]' (are you missing an assembly reference?)

如果我删除项目引用,并重新添加,红色squigglies走开,智能感知踢再喜欢它应该。所有的解决方案中的其他项目的建设没有问题。 但是当我尝试建立这个新项目,这些错误回来。

If I delete the project reference and re-add it, the red squigglies go away and Intellisense kicks in again like it's supposed to. All of the other projects in the solution build without issue. But as soon as I try to build this new project, the errors come back.

一个失败的引用是我们Core.dll,它的目标3.5。我们最近增加了针对4.0 CoreEx.dll,与组件之间的命名空间共享。这项新服务可以看到CoreEx.dll但不Core.dll ......也就是说,当我开始键入使用Core.Utilities ... 智能感知上的小套从CoreEx.dll但命名空间不显示任何仅出现在Core.dll。我是pretty的确定加入这个成功后构建的解决方案,但它是一个显着的最近的更改。

One of the failing references is to our Core.dll, which targets 3.5. We recently added a CoreEx.dll targeting 4.0, with namespace sharing between the assemblies. The new service can see CoreEx.dll but not Core.dll... i.e., when I begin typing using Core.Utilities... Intellisense picks up on the smaller set of namespaces from CoreEx.dll but does not show any that appear only in Core.dll. I'm pretty sure the solution built successfully after adding this, but it's a notable recent change.

另一个没有提到的是我们的核心Data.dll持有一堆数据集和实体框架的东西。这一次是最近迁移到4.0。同样,我几乎积极的迁移项目建成后的解决方案,但它是值得一提。

Another failing reference is to our core Data.dll which holds a bunch of datasets and Entity Framework stuff. This one was recently migrated to 4.0. Again, I'm almost positive the solution built after migrating the project, but it's worth mentioning.

最后失败参考的是,使用来自服务命名空间一层上的组件。例如,有问题的项目是根据列命名空间 ProductName.Component.ComponentService ,这是无法看到基于从命名空间的 ProductName.Component <项目/ code>。这一次是最近有问题的项目创建沿线和还针对4.0。

The last failing reference is an assembly that uses the namespace one level "up" from the service. E.g., the problematic project is based out of namespace ProductName.Component.ComponentService and it is unable to see the project based out of namespace ProductName.Component. This one was recently created along with the problematic project and also targets 4.0.

正如你所看到的,似乎没有任何没头没脑到装配引用失败...并且有问题的项目能够成功引用的部分的其他组件的解决方案。我试图清理,重新建设,重新启动Visual Studio的......什么都没有永久固定它。这可能是造成这?

As you can see, there doesn't seem to be any rhyme or reason to which assembly references are failing... and the problematic project can successfully reference some of the other assemblies in the solution. I've tried cleaning, re-building, restarting Visual Studio... nothing has fixed it permanently. What could be causing this?

推荐答案

检查新项目的目标平台,并确保它不针对.NET 4客户端配置文件。如果是,将其更改为普通的.NET 4

Check the target platform of the new project and make sure it's not targeting .NET 4 Client Profile. If it is, change it to regular .NET 4

这篇关于随机集引用失败(&QUOT;是否缺少using指令或程序集引用&QUOT;?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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