程序集搜索集不起作用 [英] assembly search set does not work

查看:86
本文介绍了程序集搜索集不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

app.config:

app.config :

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
	<runtime>
		<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
			<dependentAssembly>
				<probing privatePath="bin2"/>
			</dependentAssembly>
		</assemblyBinding>
	</runtime>
</configuration>





但这套不起作用,应用程序不会搜索bin2目录。



but this set does not work,the application does not search bin2 dir.

推荐答案

以下文章显示了实现此目的的3种方法。我认为一种方法可以满足您的需求。



您必须:

1.将MyAssembly2更改为您想要的程序集名称load(属性:名称)

2.在配置文件中设置公共令牌(Property:publicKeyToken)

3.在配置文件中设置dll版本(属性:版本)

4.在配置文件中设置dll文件的路径(属性:href)



The following article shows up 3 methods to achieve this. I think one method will fit your needs.

You have to:
1. Change "MyAssembly2" to the assembly name you want to load (Property: name)
2. Set the public token in your config file (Property: publicKeyToken)
3. Set the dll version in your config file (Property: version)
4. Set the path to the dll file in your config file (Property: href)

<configuration>
   <runtime>
      <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <dependentassembly>
            <assemblyidentity name="MyAssembly2" culture="neutral" publickeytoken="307041694a995978" />
            <codebase version="1.0.1524.23149" href="FILE://C:/Myassemblies/MyAssembly2.dll" />
         </dependentassembly>
      </assemblybinding>
   </runtime>
</configuration>





微软文章 - 方法2







你也可以使用当前app域的AssemblyResolve事件。



Microsoft Article - Method 2



You can also use the AssemblyResolve event of the current app domain.


谢谢!我将尝试这3种方法。

非常感谢你!

但是,这是什么设置< probing privatepath =bin2>?
Thank you!I will try these 3 method.
Thank you very much!
But, what do this set " <probing privatepath="bin2"> "?


这篇关于程序集搜索集不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆