在C#控制台应用程序,我们可以通过[SOLN资源管理器中添加DLL引用 - 参考及放大器;然后加入REQD dll引用。
In C# console application we can add dll reference by [Soln Explorer - References & then adding reference of reqd dll].
在这种情况下,应用程序所期望的DLL是present在同一文件夹中。如果没有,那么应用程序不能正常工作[抛出异常。
In that case,the application expects the dll to be present in same folder. if not, then application doesn't work[Throws exception].
有没有可能,如果没有present在相同的文件夹中的应用[EXE],这样我们才能从该程序可以加载REQD DLL一些其它定位\路径的DLL,然后继续其功能。
Is it possible that, if a dll in not present in same folder as that of application[exe] , then can we have some other alternative location\path from where the program can load reqd dll then continue with its functionality.
谢谢, 阿米特
您可以添加App.config文件到您的应用程序,并指定程序集的位置:
You could add App.config file to your application and specify the location of the assembly:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity
name="MyAssembly"
culture=""
publicKeyToken="8968ee41e78ce97a" />
<codeBase
version="1.0.0.0"
href="file://c:/some_path/myassembly.dll" />
</dependentAssembly>
</assemblyBinding>
</runtime>
编辑:
可能需要设置区域性=中性 验证令牌是正确的,如果大会强烈签署,否则设置公钥=空