无法加载文件或程序集(.NET、Visual Studio 2010)

发布于 2024-12-09 03:57:36 字数 3954 浏览 0 评论 0原文

我收到一个让我完全困惑的错误。我有一个 .NET 应用程序,它提取对用于自动化第 3 方程序的 OCX 文件的引用。当我从 Visual Studio 中运行该应用程序时,该应用程序运行良好,但是当我将其打包到 MSI 文件并将其安装在测试计算机上时,它失败并提示“无法加载文件或程序集“Interop.OISSERVERLib,...”。

有人对我如何处理这个问题有任何建议吗

System.InvalidOperationException was unhandled
Message=An error occurred creating the form. See Exception.InnerException for details.  The error is: Could not load file or assembly 'Interop.OISSERVERLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
Source=SLSClaimantWorkbook
StackTrace:
   at SLSClaimantWorkbook.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190
   at SLSClaimantWorkbook.My.MyProject.MyForms.get_SLSClaimantWorkbook()
   at SLSClaimantWorkbook.My.MyApplication.OnCreateMainForm() in C:\Documents and Settings\C15919\My Documents\Visual Studio 2005\Claimant Workbook\Claimant Workbook\My Project\Application.Designer.vb:line 35
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
   at SLSClaimantWorkbook.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
InnerException: System.IO.FileNotFoundException
   Message=Could not load file or assembly 'Interop.OISSERVERLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
   Source=SLSClaimantWorkbook
   FileName=Interop.OISSERVERLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
   FusionLog=WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

   StackTrace:
        at SLSClaimantWorkbook.SLSClaimantWorkbook..ctor()
   InnerException: 

? 程序集绑定信息:

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  c:\WINNT\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable  C:\Program Files\SLS\Claimant Workbook\SLSClaimantWorkbook.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: User = INTERNAL\C15919
LOG: DisplayName = Interop.OISSERVERLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
 (Fully-specified)
LOG: Appbase = file:///C:/Program Files/SLS/Claimant Workbook/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = SLSClaimantWorkbook.exe
Calling assembly : SLSClaimantWorkbook, Version=0.9.31.11788, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files\SLS\Claimant Workbook\SLSClaimantWorkbook.exe.config
LOG: Using machine configuration file from c:\WINNT\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Program Files/SLS/Claimant Workbook/Interop.OISSERVERLib.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/SLS/Claimant Workbook/Interop.OISSERVERLib/Interop.OISSERVERLib.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/SLS/Claimant Workbook/Interop.OISSERVERLib.EXE.
LOG: Attempting download of new URL file:///C:/Program Files/SLS/Claimant Workbook/Interop.OISSERVERLib/Interop.OISSERVERLib.EXE.
LOG: All probing URLs attempted and failed.

I'm getting an error that is baffling me complete. I have a .NET Application that pulls in a reference to an OCX file used to automate a 3rd party program. This applications works perfectly when I run it from within Visual Studio, but when I package it in an MSI file and install it on a test machine, it fails saying "Could not load file or assembly "Interop.OISSERVERLib, ...".

Does anyone have any suggestions on how I can deal with this?

System.InvalidOperationException was unhandled
Message=An error occurred creating the form. See Exception.InnerException for details.  The error is: Could not load file or assembly 'Interop.OISSERVERLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
Source=SLSClaimantWorkbook
StackTrace:
   at SLSClaimantWorkbook.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190
   at SLSClaimantWorkbook.My.MyProject.MyForms.get_SLSClaimantWorkbook()
   at SLSClaimantWorkbook.My.MyApplication.OnCreateMainForm() in C:\Documents and Settings\C15919\My Documents\Visual Studio 2005\Claimant Workbook\Claimant Workbook\My Project\Application.Designer.vb:line 35
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
   at SLSClaimantWorkbook.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
InnerException: System.IO.FileNotFoundException
   Message=Could not load file or assembly 'Interop.OISSERVERLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
   Source=SLSClaimantWorkbook
   FileName=Interop.OISSERVERLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
   FusionLog=WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

   StackTrace:
        at SLSClaimantWorkbook.SLSClaimantWorkbook..ctor()
   InnerException: 

EDIT:
Assembly binding info:

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  c:\WINNT\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable  C:\Program Files\SLS\Claimant Workbook\SLSClaimantWorkbook.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: User = INTERNAL\C15919
LOG: DisplayName = Interop.OISSERVERLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
 (Fully-specified)
LOG: Appbase = file:///C:/Program Files/SLS/Claimant Workbook/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = SLSClaimantWorkbook.exe
Calling assembly : SLSClaimantWorkbook, Version=0.9.31.11788, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files\SLS\Claimant Workbook\SLSClaimantWorkbook.exe.config
LOG: Using machine configuration file from c:\WINNT\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Program Files/SLS/Claimant Workbook/Interop.OISSERVERLib.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/SLS/Claimant Workbook/Interop.OISSERVERLib/Interop.OISSERVERLib.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/SLS/Claimant Workbook/Interop.OISSERVERLib.EXE.
LOG: Attempting download of new URL file:///C:/Program Files/SLS/Claimant Workbook/Interop.OISSERVERLib/Interop.OISSERVERLib.EXE.
LOG: All probing URLs attempted and failed.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一个人的旅程 2024-12-16 03:57:36

这个错误是因为我对 Visual Studio 如何处理 OCX 文件的了解有限。当我将该文件添加为程序中的引用时,该程序创建了“Interop.OISSERVERLIB.dll”,并且该程序正在使用该文件,而不是原始的 OCX。通过浏览到“bin\Debug”文件夹,我能够将 DLL 添加到安装文件中,现在它可以正常工作了!

谢谢大家为我指明了正确的方向!

This error is because of my limited understand of how Visual Studio processes OCX files. When I added the file as a reference in the program, the program created "Interop.OISSERVERLIB.dll" and the program was using that file, not the original OCX. By browsing to the "bin\Debug" folder, I was able to add the DLL to the install file, and it is now working correctly!

Thank you all for pointing me in the right direction!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文