gpt4 book ai didi

c# - 使用路径在 app.config 中的 dll

转载 作者:行者123 更新时间:2023-12-04 18:19:01 26 4
gpt4 key购买 nike

我正在为此苦苦挣扎,根本找不到太多。

我的配置文件如下:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="mydll" culture="neutral" publicKeyToken="3073773c0eff8935"/>
<codeBase version="1.0.0.0" href="FILE://C:/users/James/Desktop/mydll2.dll"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

我已经插入了我的程序集的位置以及正确的 publickeytoken 和版本。

显然我的程序集不会在 bin 文件夹中,我希望能够在我喜欢的时候更改程序集的位置。我被困在如何在我的代码中引用它。如何从我的项目中调用此汇编函数?

我假设您需要以某种方式在项目中添加对它的引用?

谢谢!

最佳答案

对于其他任何偶然发现的人......我现在已经做到了......
这里有教程...
https://web.archive.org/web/20070703223647/support.microsoft.com/kb/837908
通过使用 app.config 中的标签,程序集的位置将在运行时获得。
您应该做的就是添加对程序集的引用并将“assemblyIdentity name=”设置为添加到项目中的引用的名称。
右键引用->属性,复制local=false;
构建您的解决方案,您可以使用程序集的位置更新 app.config 文件。

关于c# - 使用路径在 app.config 中的 dll,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11073709/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com