引用的项目“丢失"了在编译时 [英] Referenced Project gets "lost" at Compile Time

查看:18
本文介绍了引用的项目“丢失"了在编译时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含两个项目的 C# 解决方案:一个服务(主项目)和一个记录器.该服务使用记录器中的类.我在服务项目中添加了对记录器项目的引用.在设计时,自动完成工作正常:记录器的类是可见的,我使用的引用具有适当的颜色.

I have a C# solution with two projects: a service (the main project) and a logger. The service uses classes from the logger. I've added a Reference to the logger project within the service project. At design time, autocomplete works fine: the logger's classes are visible, references that I use are colored appropriately.

我重新构建了解决方案,结果出错了.不再识别引用:当前上下文中不存在名称 'Logging',并且自动完成中不再存在类.删除并重新附加引用使我回到使标识符可见以自动完成的基本状态.

I Rebuild the solution, and things go wrong. The references are no longer recognized: "The name 'Logging' does not exist in the current context' and the classes no longer exist in autocomplete. Removing and reattaching the reference gets me back to the base state of having the identifiers visible to autocomplete.

我已经重新启动,清除了所有缓存,确保这是我机器上运行的唯一 VS 2010 实例.

I've rebooted, cleared all caches, made sure this is the only instance of VS 2010 running on my machine.

有什么明显(显然)我遗漏的东西吗?

Is there something obvious (obviously) that I'm missing?

推荐答案

在项目属性下检查每个项目的构建类型 - 我打赌其中一个将被设置为针对 .NET XX - Client Profile.

Check your build types of each project under project properties - I bet one or the other will be set to build against .NET XX - Client Profile.

如果版本不一致,特别是一个是 Client Profile 而另一个不是,那么它在设计时工作但在编译时失败.一个真正的问题.

With inconsistent versions, specifically with one being Client Profile and the other not, then it works at design time but fails at compile time. A real gotcha.

对我来说,Visual Studio 2010 中发生了一些有趣的事情,它总是将项目看似随机地设置为 Client Profile,有时是在我创建项目时,有时是在几天后.可能是我不小心按了一些键盘快捷键...

There is something funny going on in Visual Studio 2010 for me, which keeps setting projects seemingly randomly to Client Profile, sometimes when I create a project, and sometimes a few days later. Probably some keyboard shortcut I'm accidentally hitting...

这篇关于引用的项目“丢失"了在编译时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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