我已创建了一个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.
约翰·
更多推荐
在其他项目中不存在命名空间
发布评论