【发布时间】:2017-07-12 07:34:35
【问题描述】:
目前正在使用 WinForms 和 7zip 解包器制作一个小程序。为了更容易添加对“SevenZipSharp.dll”的引用,一切正常,直到我想发布(调试)项目。当我在桌面中移动“.exe”文件时出现错误:
System.IO.FileNotFoundException:无法加载文件或 程序集 'X' 或其依赖项之一”。
我在 .dll 文件中嵌入资源集 + 复制本地:设置为 true
如何使这些程序在当前目录中没有 .dll 的情况下运行。
编辑
我是通过使用做到的
系统.反射
但是我现在遇到了另一个问题
System.TypeInitializationException: 'The type initializer for 'SevenZip.SevenZipLibraryManager' threw an exception.. ---> System.ArgumentException: Path has an illegal format
w System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
w System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
w System.IO.Path.InternalGetDirectoryName(String path)
w System.IO.Path.GetDirectoryName(String path)
w SevenZip.SevenZipLibraryManager..cctor()
--- End of inner exception stack trace ---
w SevenZip.SevenZipLibraryManager.SetLibraryPath(String libraryPath)
w SevenZip.SevenZipBase.SetLibraryPath(String libraryPath)
【问题讨论】:
-
不是这方面的专家,但我认为它必须是
-
你到底是什么意思?不是不可能吗?
标签: c# dll reference sevenzipsharp typeinitializeexception