2015-11-27 59 views
2

我已经构建了一个类库,并且由于某种原因,当我将它放在C#文件顶部的Using Molo.Core.Reference中时,我仍然需要键入整个路径,而在代码中只输入Reference.{public}。见下面的例子。WPF不识别自定义类库

using NLog; 
using Molo.Core.Reference; 
using System; 

...

Process.Start(Molo.Core.Reference.Ground.logSite); 
log.Info("Started " + content + ". It will be started externally."); 

在VS2015的Molo.Core.Reference是灰色的像它没有被使用。当我输入Reference时,它不会出现在Inteli-sense中。唯一出现的是当我输入Molo

+0

我相信包括'Molo.Core.Reference'意味着你可以使用里面包含的内容。 IE'Ground.logSite'而不是'Reference.Ground.logSite' – teynon

+0

拉动'Ground.logSite'拉出另一个文件夹,标记为'Ground',它在项目中。我应该重命名.dll文件夹名称吗? –

+0

听起来就像你有名字空间冲突那么。也许你可以使用别名?我从来没有使用它,但据说,它是'使用myAlias = Molo.Core.Reference' – teynon

回答

3

这听起来像你有一个命名空间冲突。您有两个具有相同名称的名称空间。或者一些子命名空间与另一个命名空间冲突。您可以使用aliasusing来避免冲突。然后从alias引用您的图书馆。

using myAlias = Molo.Core.Reference; 
// .... 
myAlias.Ground.logSite;