引用的库不会被复制

由网友(酒殇)分享简介:我的项目A(WPFApplication)的引用项目B(ClassLibrary)。里面的项目B 我WPF使用控件窗口 ThirdParty.dll 至极因此,我从引用的项目B I have ProjectA(WPFApplication) that references ProjectB(ClassLibrar...

我的项目A(WPFApplication)的引用项目B(ClassLibrary)。 里面的项目B 我WPF使用控件窗口 ThirdParty.dll 至极因此,我从引用的项目B

I have ProjectA(WPFApplication) that references ProjectB(ClassLibrary). Inside ProjectB i have wpf window that uses control from ThirdParty.dll wich i accordingly reference from ProjectB.

现在的问题是,它并没有找到 ThirdParty.dll 在项目A 和XAML解析运行exce​​prion提高输出文件夹。 没有 ThirdParty.dll 在GAC。 复制本地设置为true。 它的工作原理,如果我在项目A 该库的输出文件夹手动添加它也可以,如果我使用的 ThirdParty.dll somwhere就在我的CS文件。

The problem is that it doesn't find ThirdParty.dll in output folder of ProjectA and xaml parse runtime exceprion is raised. There is no ThirdParty.dll in GAC. Copy Locally is set to true. It works if i manually add in output folder of ProjectA that library and it also works if i use that ThirdParty.dll somwhere right in my cs files.

我该如何解决呢?

推荐答案

这样做的原因是,Visual Studio中只复制资源到输出文件夹,如果复制本地设置。只需设置基准以复制本地,你应该罚款。

The reason for this is that visual studio only copies resources to the output folder if Copy Local is set. Just set the reference to Copy Local and you should be fine.

看看这个链接这是如何工作的。

Check out this link on how this works.

在引用项目A,从项目B引用不会自动引用。对于这个工作,你需要添加从项目A引用ThirdParty.dll,以及如果你只使用它在XAML。编译器不复制引用仅在XAML中使用。但是,如果你使用他们在code,它们被复制。

When you reference ProjectA, the references from ProjectB is not automatically referenced. For this to work, you need to add a reference to ThirdParty.dll from ProjectA as well if you only use it in XAML. The compiler does not copy references that are only used in XAML. But if you use them in code, they are copied.

这是同样的问题作为讨论的这里

This is the same issue as discussed here

阅读全文

相关推荐

最新文章