[英]I added a project as reference but it still cannot be found
I'm using VS10 and C# and I've encountered a weird problem. 我正在使用VS10和C#,但遇到了一个奇怪的问题。 I have 2 project A and B, A is a class library, and B is a console project.
我有2个项目A和B,A是一个类库,而B是一个控制台项目。 B depends on A, so I added the project reference of A to B.
B取决于A,因此我将A的项目参考添加到B。
But when I use types created in project A in project B, VS complains the following: 但是,当我在项目B中使用在项目A中创建的类型时,VS会抱怨以下内容:
The type or namespace name could not be found (are you missing a using directive or an assembly reference?)
找不到类型或名称空间名称(您是否缺少using指令或程序集引用?)
I've never encountered this problem before, does anyone know what went wrong? 我以前从未遇到过这个问题,有人知道出了什么问题吗?
Thanks. 谢谢。
Since you have Project B targetting Client Profile
while the library is built for 4.0
this cannot be done. 由于在为
4.0
构建该库时具有Project B定位Client Profile
,因此无法完成此操作。
You will have to upgrade the console app to target 4.0
您将必须将控制台应用程序升级到目标
4.0
If you are targeting the .NET Framework 4 Client Profile, you cannot reference an assembly that is not in the .NET Framework 4 Client Profile.
如果您以.NET Framework 4客户端配置文件为目标,则不能引用不在.NET Framework 4客户端配置文件中的程序集。 Instead you must target the .NET Framework 4.
相反,您必须针对.NET Framework 4。
There might be one of these reasion. 可能有其中一种。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.