问题描述
大家好,
我引用的程序集有问题.
总的来说,我有很多参考资料,但我不想将它们复制到项目输出文件夹中.
我的文件夹结构如下所示:
Hello folks,
I''ve got a problem with referenced assemblies.
In general I have a lot of references and I don''t want them to be copied to the project output folder.
My folder structure looks like this:
- Build
- 3rdParty
- Common
- Plugins
我要将可执行文件放在根文件夹(生成")中.所有第三方程序集均应位于文件夹"3rdParty"中.我在Common文件夹中写的所有库,所有插件都相同(我使用MEF).
插件运行良好.没问题.
与文件夹"Common"相同.我只是在相应项目的项目属性中将输出路径设置为文件夹"Common",并在引用程序集的属性中设置相应的引用路径.
但是我遇到了第三方库的问题.
我像往常一样添加了它们,作为对我的项目的参考.然后,我调用了该引用的相应属性页,并将Copy to local folder
设置为false
.之后,我在解决方案中创建了一个名为"3rdParty"的子文件夹.在那里,我将所有第三方程序集都添加为Content
,并且Copy to output directory
设置为Always copy
.
另外,我在解决方案中添加了app.config
.
内容,我想这是错误的:)
I want my executable in the root folder (Build). All third-party assemblies shall be located in the folder ''3rdParty''. All libraries I wrote myself in the folder ''Common'', same for all plugins (I''m using MEF).
Plugins is working well. No problem here.
Same for folder ''Common''. I just set the output path in the project properties of the according project to folder ''Common'' and in the properties of the referencing assembly I set the according reference path.
But I ran into problems with the 3rd party libraries.
I added them as usual as reference to my project. Then I called the according property page of that reference and set Copy to local folder
to false
. Afterwards I''ve created a sub-folder in my solution called ''3rdParty''. There I''ve added all the 3rd party assemblies as Content
with Copy to output directory
set to Always copy
.
In addition I''ve added an app.config
to my solution.
The content, I guess it''s wrong :)
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding xmlns="svl:WPFSoundVisualizationLib">
<probing privatePath="3rdParty;" />
<dependentAssembly>
<assemblyIdentity name="WPFSoundVisualizationLib" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
当我尝试运行我的应用程序时,我得到一个System.Windows.Markup.XamlParseException
说我的MainWindow类型的构造函数在x线的y位置抛出了异常.XAML的相应位置引用了我的第三方大会.
When I''m trying to run my application I get an System.Windows.Markup.XamlParseException
saying that my constructor of type MainWindow threw an exception at line x position y.
At the according postion of my XAML is my 3rd party assembly referenced.
xmlns:svl="clr-namespace:WPFSoundVisualizationLib;assembly=WPFSoundVisualizationLib"
有人可以告诉我,我在做什么错吗?
预先谢谢.
Can anybody please tell me, what I''m doing wrong?
Thanks in advance.
推荐答案
<configuration>
<runtime>
<assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatepath="Common;3rdParty" />
</assemblybinding>
</runtime>
</configuration>
这篇关于引用的程序集与项目输出的路径不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!