在其他项目中不存在命名空间

编程入门 行业动态 更新时间:2024-10-25 18:36:42
本文介绍了在其他项目中不存在命名空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已创建了一个C#控制台应用程序。在这种应用中,我有很多的命名空间。

I have created one C# console application. In that application, I have many namespaces.

例如:

namespace com.xyz.foo.bar { } namespace com.xyz.abc.def { }

当我加入这个控制台应用程序中引用到WCF服务项目,一些命名空间不适用于进口。即从上面的例子中,我可以得到 com.xyz.foo.bar 命名空间,但 com.xyz.abc.def 命名空间不可用。

When I added reference of this console application into an WCF service project, some of the namespaces are not available for import. i.e. from above example I can get com.xyz.foo.bar namespace but com.xyz.abc.def namespace is not available.

我不明白为什么会这样。

I dont understand why this is happening.

如果我打开控制台应用程序的可执行文件,从对象浏览器我可以看到所有的命名空间。

If I open executable of console application from 'object browser' I can see all the namespaces.

谁能解释这件事情背后的原因??

Can anyone explain the reason behind this thing??

推荐答案

我在那里一个命名空间没有被发现即使是在同一个解决方案的项目引用了类似的问题,类型为公,等等。

I had a similar issue where a namespace was not found even though there was a project reference in the same solution, types were public, etc..

原来,我需要改变目标框架是.NET Framework 4的,而不是.NET Framework 4的客户端配置文件。我没有理会搞清楚为什么这导致了一个未知的命名空间的错误,但它解决了我的问题。

It turned out that I needed to change the "Target Framework" to be ".NET Framework 4" instead of ".NET Framework 4 Client Profile". I didn't bother figuring out why this resulted in an "unknown namespace" error, but it solved my problem.

约翰·

更多推荐

在其他项目中不存在命名空间

本文发布于:2023-10-07 10:35:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1469156.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:中不   项目   空间

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!