2013-12-11 39 views
-2

我正在用C#编写一个服务,并且我的类库原始名称的开头是:Common。如何更改类库名称?

而这个名字与另一个动态链接库冲突:common.logging.dll

我改变了它,但是当我将它引用到另一个库时,它也是冲突。尽管我将名称更改为:jsptpd.commom

这是冲突代码:

private static readonly Common.Logging.ILog logger = Common.Logging.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 

而且它是在程序的名字显示的名字,但是当我引用和输入类常见的,这也提示了旧名称,而不是common.logging。

如何解决?

冲突:

当我referece的Common.Logging.dll和jsptpd.CommonImpl(旧名是常见的).dll文件。

程序提示:

Namespace jsptpd.common not exists type or namespace "logging",do you lack of dll or reference? 

但是,当我没有引用jsptpd.CommonImpl(the old name is common).dll记录可以更正:

Common.Logging.ILog. 
+0

请解释“冲突”。 – CodeCaster

+0

我不确定你在问什么,但也许你可以从[使用指令(C#参考)](http://msdn.microsoft.com/en-us/library /sf0df423.aspx)。 –

+0

听起来我很诧异,你把程序集名称与命名空间名称搞混了。这是重要的命名空间名称。回到那个项目,选一个更好的名字。 –

回答

1

我不知道我完全理解你的问题。

基本上你有两个叫做Common.Something1和Common.Something2的程序集。当你使用Common.Something1中的类时,你会得到一个错误,因为他假定你在Common.Something2中。

如果你的问题是这个,解决起来很简单。

在该类的使用区域中,您可以使用别名定义using。

using CommonNamespace1 = Common.Something1; 
using CommonNamespace2 = Common.Something2; 

,并在代码的其余部分,你喜欢声明

private static readonly CommonNamespace1.Logging.ILog logger = CommonNamespace1.Logging.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 

如果这不是你的问题,请详细更多。

+0

是的,它完全可以解决我的问题!!!谢谢。 – Dolphin