我有一個可執行文件(Foo.exe)和一個庫Bar.dll。這兩個二進制文件都是不是強名稱簽名。該Bar.dll庫依賴於可執行文件,並在其清單以這種方式指定:程序集重新編譯和彙編加載問題
<dependency>
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="Foo.exe" size="334336">
<assemblyIdentity name="Foo" version="1.2.3.4" language="neutral" processorArchitecture="msil" />
</dependentAssembly>
</dependency>
我從foo.exe的往返 - > MSIL - > foo.exe的與ILDASM和ILASM。用ildasm反編譯生成一個.il文件,.res文件和多個.resources文件。我以這種方式重新編譯應用程序:
ilasm Foo.il /resource=Foo.res
重新編譯後,應用程序可以運行並可以啓動。現在的問題是,依賴於可執行文件的Bar.dll無法在重新編譯之後加載它(Foo.exe可執行文件)。這就是融合日誌給我:
*** Assembly Binder Log Entry (11/12/2012 @ 5:00:38 PM) ***
The operation failed.
Bind result: hr = 0x8013101b. No description available.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable C:\Program Files (x86)\SomeApplication\Something.EXE
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = Bartek-W7\Bartek
LOG: DisplayName = Bar, Version=1.2.3.4, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/FooBar
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : Bar, Version=1.2.3.4, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Application configurtion file not found.
LOG: Using machine configuration file from C:\Windows\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 (x86)/FooBar/Foo.dll
LOG: Attempting download of new URL file:///C:/Program Files (x86)/FooBar/Foo/Foo.dll
LOG: Attempting download of new URL file:///C:/Program Files (x86)/FooBar/Foo.exe
LOG: Assembly download was successful. Attempting setup of file: C:/Program Files (x86)/FooBar/Foo.exe
LOG: Entering download cache setup phase.
ERR: Error extracting manifest import from file (hr = 0x8013101b).
ERR: Setup failed with hr = 0x8013101b.
ERR: Failed to complete setup of assembly (hr = 0x8013101b). Probing terminated.
現在重新編譯之前成功加載文件,並在融合日誌,唯一的區別是最後四行:
LOG: set name: Foo, Version=1.2.3.4, Culture=neutral, PublicKeyToken=null
WARNING: found a duplicate set during cache setup
LOG: Bind successful.
LOG: Bind is in default load context.