【发布时间】:2020-06-09 15:58:06
【问题描述】:
我不知道我做错了什么。
我的项目是这样的:
主项目
SubProject(引用我的愿望 DLL)
我有我的 app.config(MainProject 的):
<configuration>
<configSections>
<section name="DirectoryServerConfiguration" type="System.Configuration.NameValueSectionHandler"/>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net"/>
<section name="GeneralConfiguration" type="System.Configuration.NameValueSectionHandler"/>
<section name="ServerConnectionConfiguration" type="System.Configuration.NameValueSectionHandler"/>
<section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings,Microsoft.Practices.EnterpriseLibrary.Caching"/>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="ReferencesDLL" />
</assemblyBinding>
</runtime>
<GeneralConfiguration configSource="ConfigFiles\GeneralConfiguration.config"/>
<cachingConfiguration configSource="ConfigFiles\cachingConfiguration.config"/>
<DirectoryServerConfiguration configSource="ConfigFiles\YPAdress.config"/>
<log4net configSource="ConfigFiles\log4net.config"/>
</configuration>
我的编译库是这样的:
- 调试
- ConfigFiles\(app.config 中定义的所有 .config 文件)
- ReferencesDLL\(子项目所需的所有DLL)
- (所有其他编译文件:.exe、.dll 等)
如您所见,我定义了 privatePath,但是在运行应用程序时,它找不到 SubProject 所需的 dll。 (.config 文件没有问题) 我不知道我做错了什么:(。
【问题讨论】:
-
你也可以使用
AppDomain.AssemblyResolve来解决这个问题 -
我不明白你的回答。我希望我的应用程序在 ReferencesDLL\MyDLL.dll 中搜索,而不是 ./MyDll.dll 在您的示例中,我看不到任何指定路径的方法
标签: c# visual-studio dll dll-reference