EnterpriseLibrary.Logging.Database assembly linking issue with Workflow - c#

I get the following error when i try to run a console program which calls a Workflow 4 activity I created. Note the workflow compiles and runs without issue when executed from unit Tests or embedded in another workflow.
Could not load file or assembly
'Microsoft.Practices.EnterpriseLibrary.Logging.Database,
PublicKeyToken=31bf3856ad364e35' or
one of its dependencies. The system
cannot find the file specified.
I am using EnterpriseLibrary 5.0 for logging and connection strings.
I notice that the path to the assemblies is as follows:
C:\Program Files (x86)\Microsoft
Enterprise Library
5.0\Bin\Microsoft.Practices.EnterpriseLibrary.*
Looking at the Assembly Binding Log is
see the following:
* Assembly Binder Log Entry (17/03/2011 # 15:32:48) *
The operation failed. Bind result: hr
= 0x80070002. The system cannot find the file specified.
Assembly manager loaded from:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable
C:\Development\Work\EquinoxeAISManagementSystemWorkflow\EquinoxeAISManagementSystemWorkflow.FeedManager\bin\Debug\EquinoxeAISManagementSystemWorkflow.FeedManager.vshost.exe
--- A detailed error log follows.
=== Pre-bind state information === LOG: User = EQUINOXEAIS\pmckee LOG:
DisplayName =
Microsoft.Practices.EnterpriseLibrary.Logging.Database,
Version=5.0.414.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35
(Fully-specified) LOG: Appbase =
file:///C:/Development/Work/EquinoxeAISManagementSystemWorkflow/EquinoxeAISManagementSystemWorkflow.FeedManager/bin/Debug/
LOG: Initial PrivatePath = NULL LOG:
Dynamic Base = NULL LOG: Cache Base =
NULL LOG: AppName =
EquinoxeAISManagementSystemWorkflow.FeedManager.vshost.exe
Calling assembly :
EquinoxeAISManagementSystemWorkflow.ActivityLibrary,
Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null.
LOG: This bind starts in default load
context. 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.Practices.EnterpriseLibrary.Logging.Database,
Version=5.0.414.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35 LOG:
GAC Lookup was unsuccessful. LOG:
Attempting download of new URL
file:///C:/Development/Work/EquinoxeAISManagementSystemWorkflow/EquinoxeAISManagementSystemWorkflow.FeedManager/bin/Debug/Microsoft.Practices.EnterpriseLibrary.Logging.Database.DLL.
LOG: Attempting download of new URL
file:///C:/Development/Work/EquinoxeAISManagementSystemWorkflow/EquinoxeAISManagementSystemWorkflow.FeedManager/bin/Debug/Microsoft.Practices.EnterpriseLibrary.Logging.Database/Microsoft.Practices.EnterpriseLibrary.Logging.Database.DLL.
LOG: Attempting download of new URL
file:///C:/Development/Work/EquinoxeAISManagementSystemWorkflow/EquinoxeAISManagementSystemWorkflow.FeedManager/bin/Debug/Microsoft.Practices.EnterpriseLibrary.Logging.Database.EXE.
LOG: Attempting download of new URL
file:///C:/Development/Work/EquinoxeAISManagementSystemWorkflow/EquinoxeAISManagementSystemWorkflow.FeedManager/bin/Debug/Microsoft.Practices.EnterpriseLibrary.Logging.Database/Microsoft.Practices.EnterpriseLibrary.Logging.Database.EXE.
LOG: All probing URLs attempted and
failed.
I have tried the following to resolve the issue:
- Setting 'Specific version' to False for all referanced EnterpriseLibrary assemplies
- Recreating the app.config using the EnterpriseLibrary config tool again (and again and again :(
- Deleting all references assemblies and adding them back in one by one.
I would be really grateful if anyone had further pointer as to how to debug this issue.....THANKS!

I see three possible issues...
Your app is x64 (C:\Windows\Microsoft.NET\Framework64\), is Microsoft.Practices.EnterpriseLibrary.Logging.Database x86 or x64? (never tried to do this so I'm not sure if it can be done or not)
Is this file being copied local on build? It has to be located in C:/Development/Work/[snip]/bin/Debug in order for the fusion loader to find it. Fusion won't look under every directory.
It is in the GAC, but it is not in the directory mentioned in #2. Fusion must first find the assembly under the install directory before it will probe the GAC for the assembly, IIRC*.
*this behavior depends on how the assembly is loaded at runtime using a partial bind, i.e., not using the assembly's strong name.

Related

System.IO.FileLoadException during loading .NET assembly: error 0x8007007a

We are having an issue related to starting a few in house developed .NET applications on Windows 10 Version 1607 machines. Sometimes starting an application doesn't succeed. This is because loading a dependent .NET assembly fails. The error message is:
System.IO.FileLoadException: Could not load file or assembly
'[assemblyname], Version=[version], Culture=neutral,
PublicKeyToken=[publickeytoken]' or one of its dependencies. The data
area passed to a system call is too small. (Exception from HRESULT:
0x8007007A)
The issue happens about 10% of the application startups in different .NET applications. It happens with 32-bit as well as 64-bit applications. During all the startups also many other applications start that start up OK. I wonder why we get the 0x8007007a error? Maybe it is collateral due to a heap corruption that happened before?
You can see related logging from FUSLOGVW below. The filepaths and assembly names are anonymised. The assembly that is attempted to be loaded has quite a long name (59 characters without the .dll postfix). As a test, we changed the name of the assembly to a shorter name. Unfortunately the issue remained. Adding a probing path in the exe.config also did not fix the issue.
Furthermore, there seems to be code of an older version of the Microsoft Assembly Resolver available at Github: https://github.com/fixdpt/shared-source-cli-2.0. I suspect there is something wrong in the ConstructCodeBaseList in adlmgr.cpp. But I can't figure out what triggers the issue.
*** Assembly Binder Log Entry (2020/01/30 # 13:48) ***
The operation failed.
Bind result: hr = 0x8007007a. The data area passed to a system call is too small.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Program Files (x86)\XXX\XXX\XX.X.X.X\XXX\XXXXXXXXXXXXXX\ApplicationWeWantToStart.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = AnAssem.blyWi.th.AVeryLon.gNameAA.AAAAAAAA.AAAAAAAAAAA.AAAA, Version=13.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXXXXXX
(Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/XXX/XXX/XX.X.X.X/XXX/XXXXXXXXXXXXXX/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = ApplicationWeWantToStart.exe
Calling assembly : ApplicationWeWantToStart, Version=13.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXXXXXX.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files (x86)\XXX\XXX\XX.X.X.X\XXX\XXXXXXXXXXXXXX\ApplicationWeWantToStart.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: AnAssem.blyWi.th.AVeryLon.gNameAA.AAAAAAAA.AAAAAAAAAAA.AAAA, Version=13.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXXXXXX
LOG: GAC Lookup was unsuccessful.
ERR: Error occurred constructing the probing codebase list.
ERR: Unrecoverable error occurred during pre-download check (hr = 0x8007007a).
Any change your startup issue may be related to this Microsoft Support Link

Assembly Binding Error: Unrecoverable error occurred during pre-download check (hr = 0x80070780)

I have a .NET 4.5 application that works and runs with no issues in most environments; however, one area of the application throws a runtime assembly reference error on some client machines:
Could not load file or assembly 'System.Xml.Linq, Version 4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The file cannot be accessed by the system. (Exception from HRESULT: 0x80070780)
I ran the fusion logs and interestingly, this assembly seems to be loaded twice, once for version 4.0.0.0 and then for version 3.5.0.0 when Newtonsoft.Json version 6.0.8 is loaded. The first load works and the second is where the binding error comes from.
Here is the Fusion log for the successful 4.0.0.0 bind:
<meta http-equiv="Content-Type" content="charset=unicode-1-1-utf-8"><!-- saved from url=(0015)assemblybinder: --><html><pre>
*** Assembly Binder Log Entry (1/16/2017 # 12:40:06 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 C:\Users\<user>\AppData\Local\Apps\MyApplicationPath\MyApplication.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL
(Fully-specified)
LOG: Appbase = file:///C:/Users/<user>/AppData/Local/Apps/MyApplicationPath/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MyApplication.exe
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\<user>\AppData\Local\Apps\MyApplicationPath\MyApplication.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: Found assembly by looking in the GAC.
LOG: Binding succeeds. Returns assembly from C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll.
LOG: Assembly is loaded in default load context.
</pre></html>
And here is the unsuccessful 3.5.0.0 bind:
<meta http-equiv="Content-Type" content="charset=unicode-1-1-utf-8"><!-- saved from url=(0015)assemblybinder: --><html><pre>
*** Assembly Binder Log Entry (1/16/2017 # 12:41:12 PM) ***
The operation failed.
Bind result: hr = 0x80070780. The file cannot be accessed by the system.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Users\<user>\AppData\Local\Apps\MyApplicationPath\MyApplication.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
(Fully-specified)
LOG: Appbase = file:///C:/Users/<user>/AppData/Local/Apps/MyApplicationPath/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MyApplication.exe
Calling assembly : Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\<user>\AppData\Local\Apps\MyApplicationPath\MyApplication.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: Version redirect found in framework config: 3.5.0.0 redirected to 4.0.0.0.
LOG: Post-policy reference: System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
LOG: Binding succeeds. Returns assembly from C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll.
LOG: Assembly is loaded in default load context.
ERR: Unrecoverable error occurred during pre-download check (hr = 0x80070780).
</pre></html>
What really makes no sense to me is that it is loading the assembly from the same exact location, and it just is not working the second time around. I thought this was perhaps due to a lock of some sorts on the GAC assembly, but after checking the Fusion log on a working environment, the log file is the same, just without the final error line, so that is not it.
What is also interesting is that this problem appears to only be happening on Windows 10 machines, but not all Windows 10 machines. It also appears to not be limited to upgrades or fresh Win10 installs; it happens on both.
I have tried numerous things to fix this problem, including:
.NET repair
fully removing and re-installing .NET
clearing temporary ASP.NET files
adding assembly binding redirects/probing to the application config files to manually point to the file referenced the application's bin folder or the root folder (tried this for version 3.5, 4.0, and 4.5 of the referenced assembly.
Using the Windows 10 Repair functionality to reinstall the OS (and keep the files)
Ensuring the required assembly is located in the GAC (in the new GAC location)
Republishing the application using the latest version of Newtonsoft.Json.
creating a basic test app that references Newtonsoft.Json and the same System.Xml.Linq assembly (that works on the bad machines)
I appear to be running out of options, and unfortunately, I cannot get a more specified error than "Unrecoverable error," so I am not sure where else to look. Any help is greatly appreciated!

C# binding failure on missing ".resources" files

I have a C# program that links to a (large) third-party library and builds successfully with it. All necessary references between my program and the library are included, and the program starts correctly.
Upon loading the .NET managed DLL for the aforementioned library, I get a System.IO.FileNotFoundException that says that the library or one of its dependencies could not be loaded ("The specified module could not be found.").
Since the relevant DLL is present in the Release directory, I went through the fusion event logs and found only binding failures for a bunch of nonexistent <PROJECT>.resource.<DLL|EXE> files under a nonexistent Release\en directory. This doesn't make much sense to me at all, since the project's only resource (a single icon) is internalized.
The logs look like this, with some information redacted:
*** Assembly Binder Log Entry (7/11/2016 # 10:08:49 AM) ***
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Users\USER\Desktop\PROJECT\bin\x86\Release\PROJECT.vshost.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = PROJECT.resources, Version=1.0.0.0, Culture=en, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///C:/Users/USER/Desktop/PROJECT/bin/x86/Release/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = PROJECT.vshost.exe
Calling assembly : PROJECT, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\USER\Desktop\PROJECT\bin\x86\Release\PROJECT.vshost.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: 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:/Users/USER/Desktop/PROJECT/bin/x86/Release/en/PROJECT.resources.DLL.
LOG: Attempting download of new URL file:///C:/Users/USER/Desktop/PROJECT/bin/x86/Release/en/PROJECT.resources/PROJECT.resources.DLL.
LOG: Attempting download of new URL file:///C:/Users/USER/Desktop/PROJECT/bin/x86/Release/en/PROJECT.resources.EXE.
LOG: Attempting download of new URL file:///C:/Users/USER/Desktop/PROJECT/bin/x86/Release/en/PROJECT.resources/PROJECT.resources.EXE.
LOG: All probing URLs attempted and failed.
Update: This is what Process Monitor shows when loading the DLL:
The first three loads are the relevant DLL, and the following ones are (ostensibly) its dependencies, all from the standard VS C++ redistributable.
Update 2: Dependency Walker shows the same DLLs as missing, although this doesn't seem to manifest at load time:

Custom Control Load Issue

We have a custom control named HostStatusControl. When we are placing the control to a form, we are getting the following error message. ICEIOBridge is one of the CLI libraries referred by the control. If we remove ICEIOBridge, the error message will be shown with another CLI library referred by the control
What could be the reason for the issue?
---------------------------
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
---------------------------
We tried with the Fusion Log viewer and the log content is given below.
Information from VS Error Message
---------------------------
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 (Devenv)
*** 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.
This looks like DLL hell, try removing all references, perform a clean on the build and reference everything back again.
In my experience, it can be because of two things:
If FileNotFoundException has been occured on an existing file, i.e. you are sure that the file exists (in file-system or GAC), it may its because of it's version. I mean when you have a dll named A which references B, and B itself references C, then when C changes it's version, then you should re-build B against the new dll C, and then rebuild A. In result, I think re-building the user control (and all underlying dependant your own dlls) with VS2010 may help.
Another possibility is that you're trying to run a dll on a 64bit OS but one (or more) of it's underlying dependant dlls is compiled only for 32bit OS. In result, I think re-building the user control with "x86" option instead of "any cpu" may help.

How to find what depends on a specific version of a specific dependency?

I'm getting this error when I run my app (not at compile time):
Could not load file or assembly
'Castle.Windsor, Version=2.1.0.0,
Culture=neutral,
PublicKeyToken=407dd0808d44fbdc' or
one of its dependencies. The located
assembly's manifest definition does
not match the assembly reference.
(Exception from HRESULT: 0x80131040)
My solution has many projects, using project references where possible, but some of those projects have assembly references to external dependencies.
How can I easily find out which project is looking for this specific version of Castle.Windsor.dll? I don't have that version and am trying to use 2.5.2 (latest), so I want to find the culprit and update it to use the latest one.
Many thanks in advance.
UPDATE
I've added a sanitised Fusion log below. It appears to be telling me that Caliburn.Castle requires Castle.Windsor, Version=2.1.0.0 (which would be a mistake as I'm using 2.5), but Fusion assembly probing as actually finding Castle.Windsor, Version=2.5.1.0 instead.
Have I understood that correctly?
=== Pre-bind state information ===
LOG: User = Barney\neil
LOG: DisplayName = Castle.Windsor, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc
(Fully-specified)
LOG: Appbase = file:///[Debug folder of my exe]
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = [Filename of my exe]
Calling assembly : Caliburn.Castle, Version=1.1.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: [Config file for my exe]
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: Castle.Windsor, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///[Debug folder of my exe]/Castle.Windsor.DLL.
LOG: Assembly download was successful. Attempting setup of file: [Debug folder of my exe]\Castle.Windsor.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: Castle.Windsor, Version=2.5.1.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc
WRN: Comparing the assembly name resulted in the mismatch: Minor Version
ERR: The assembly reference did not match the assembly definition found.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
You could use the Fuslogvw.exe utility which will provide you more information on the calling assembly. Scott Hansleman also blogged about it.
Have you looked at the assembly binding log viewer (Fuslogvw.exe)?
This should provide all the information needed.
See on MSDN.
FusionLog tool is best tool for things like that, but sometimes will only point to your code. Try turning up the verbosity for MSBuild and you might be able to track it down to where the compilation is at when it fails.

Categories

Resources