我们有一个名为 HostStatusControl 的自定义控件。当我们将控件放置到窗体时,我们会收到以下错误消息。ICEIOBridge
是控件引用的 CLI 库之一。如果我们删除 ICEIOBridge,错误消息将与控件引用的另一个 CLI 库一起显示
问题的原因可能是什么?
---------------------------
Microsoft Visual Studio
---------------------------
Failed to create component 'HostStatusControl'. The error message follows:
'System.IO.FileNotFoundException: Could not load file or assembly 'ICEIOBridge, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'ICEIOBridge, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null'
at NeST.ICE.UI.TitlePanel.HostStatusControl..ctor()
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].
'
---------------------------
OK
---------------------------
我们尝试使用 Fusion Log 查看器,日志内容如下所示。
来自 VS 错误消息的信息
---------------------------
Microsoft Visual Studio
---------------------------
Failed to create component 'HostStatusControl'. The error message follows:
'System.BadImageFormatException: Could not load file or assembly 'TestCLI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3045f9e53eded2d0' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: 'TestCLI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3045f9e53eded2d0'
at NeST.ICE.UI.TitlePanel.HostStatusControl..ctor()
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable D:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = TVM\monisha.mj
LOG: DisplayName = TestCLI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3045f9e53eded2d0
(Fully-specified)
LOG: Appbase = file:///D:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configur...'
---------------------------
OK
Fusion Log1(开发)
*** Assembly Binder Log Entry (12/5/2012 @ 1:29:11 PM) ***
The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable D:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = TVM\monisha.mj
LOG: DisplayName = Microsoft.VisualStudio.Platform.AppDomainManager, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
(Fully-specified)
LOG: Appbase = file:///D:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = devenv.exe
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Download of application configuration file was attempted from file:///D:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/devenv.exe.Config.
LOG: Found application configuration file (D:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.Config).
LOG: Private path hint found in configuration file: PublicAssemblies;PrivateAssemblies;CommonExtensions\Microsoft\TemplateProviders;PrivateAssemblies\DataCollectors;PrivateAssemblies\DataCollectors\x86;CommonExtensions\Microsoft\Editor;CommonExtensions\Platform\Debugger.
LOG: Using application configuration file: D:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.VisualStudio.Platform.AppDomainManager, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: Reusing an assembly instance that was previously loaded (C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.Platform.AppDomainManager\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Platform.AppDomainManager.dll).
Fusion Log2(Windows Forms Application1.vshost.exe)
*** Assembly Binder Log Entry (12/5/2012 @ 1:29:33 PM) ***
The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable D:\TestApplication\WindowsFormsApplication1\WindowsFormsApplication1\bin\Release\WindowsFormsApplication1.vshost.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = TVM\monisha.mj
LOG: DisplayName = Microsoft.VisualStudio.HostingProcess.Utilities, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
(Fully-specified)
LOG: Appbase = file:///D:/TestApplication/WindowsFormsApplication1/WindowsFormsApplication1/bin/Release/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = WindowsFormsApplication1.vshost.exe
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Download of application configuration file was attempted from file:///D:/TestApplication/WindowsFormsApplication1/WindowsFormsApplication1/bin/Release/WindowsFormsApplication1.vshost.exe.config.
LOG: Configuration file D:\TestApplication\WindowsFormsApplication1\WindowsFormsApplication1\bin\Release\WindowsFormsApplication1.vshost.exe.config does not exist.
LOG: No application configuration file found.
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.VisualStudio.HostingProcess.Utilities, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
LOG: Found assembly by looking in the GAC.
LOG: Binding succeeds. Returns assembly from C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll.
LOG: Assembly is loaded in default load context.