I have been trying to solve an assembly binding issue for the last 12 hours, with not much luck. Last week, I had upgraded all of the projects in a solution from EF 4.1.0.0 to EF 4.3.1.0. I added some tests this morning to an existing test project, cleaned and recompiled the solution. All the projects compile with no warnings or errors. At my entity framework call anywhere in the project, I receive the following exception:
Initialization method
NutricityPPCTests.Common.DizzleProductExtensionsTests.TestSetup threw
exception. System.IO.FileLoadException: System.IO.FileLoadException:
Could not load file or assembly 'EntityFramework, Version=4.1.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040).
I fired up the fusion assembly binding log viewer, and found the log entry that corresponds to the exception. I have verified that my test project, the MOMData project both are referencing the correct EF4.3.1.0 assembly. I verified there were no references to EF 4.1.0.0 in the project files. I deleted the contents of the obj and bin directories in both projects. The project has been cleaned and rebuilt so many times, that my hard drive is probably going to give out tomorrow.
*** Assembly Binder Log Entry (3/22/2012 # 5:55:11 PM) ***
The operation failed.
Bind result: hr = 0x80131040. No description available.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable c:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\QTAgent32.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = NUTRICITY0\awolske
LOG: DisplayName = EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
(Fully-specified)
LOG: Appbase = file:///C:/Users/awolske/Documents/NutricityWorkspace/Nutricity/NutricityPPCTests/bin/Release
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = QTAgent32.exe
Calling assembly : MomData, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\awolske\Documents\NutricityWorkspace\Nutricity\NutricityPPCTests\bin\Release\NutricityPPCTests.DLL.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: EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Users/awolske/Documents/NutricityWorkspace/Nutricity/NutricityPPCTests/bin/Release/EntityFramework.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Users\awolske\Documents\NutricityWorkspace\Nutricity\NutricityPPCTests\bin\Release\EntityFramework.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: EntityFramework, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
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.
Where else should I be looking for the old referenced assembly?!? Any help would be welcome, and greatly appreciated! Thanks in advance for your time!
Add the following to your web.config file:
<runtime>
<assemblyBinding>
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.3.1.0" newVersion="4.3.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
I had the same error. Most of the projects in my solution where referencing the Entity Framework 4.3.0.0 dll, but when I checked the references for all the projects in my solution, I found some projects referencing the Entity Framework 4.1.0.0 dll. Removing and replacing them with new references to the Entity Framework 4.3.0.0 dll fixed the problem.
Related
I have a web project built in Visual Studio 2012. Its using the Oracle.DataAccess.dll
Now the one I see in my solution is 4.121 version. But am receiving this error where the project is looking for 2.122 version.
Thanks for your help in advance
Below is the stack trace
=== Pre-bind state information === LOG: DisplayName = Oracle.DataAccess, Version=2.122.1.0, Culture=neutral,
PublicKeyToken=89b483f429c47342 (Fully-specified) LOG: Appbase =
file:///C:/TFS/IVAS/CPTSBaselineCode/FrontEndApplications/CampaignPerformanceTracking/CampaignPerformanceTracking/
LOG: Initial PrivatePath =
C:\TFS\IVAS\CPTSBaselineCode\FrontEndApplications\CampaignPerformanceTracking\CampaignPerformanceTracking\bin
Calling assembly : Aarp.Cpts.DataObjects, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null.
=== LOG: This bind starts in default load context. LOG: Using application configuration file:
C:\TFS\IVAS\CPTSBaselineCode\FrontEndApplications\CampaignPerformanceTracking\CampaignPerformanceTracking\web.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: Oracle.DataAccess, Version=2.122.1.0,
Culture=neutral, PublicKeyToken=89b483f429c47342 LOG: Attempting
download of new URL
file:///C:/Users/XXX/AppData/Local/Temp/1/Temporary ASP.NET
Files/vs/ecf130a4/7d736bb0/Oracle.DataAccess.DLL. LOG: Attempting
download of new URL
file:///C:/Users/XXX/AppData/Local/Temp/1/Temporary ASP.NET
Files/vs/ecf130a4/7d736bb0/Oracle.DataAccess/Oracle.DataAccess.DLL.
LOG: Attempting download of new URL
file:///C:/TFS/IVAS/CPTSBaselineCode/FrontEndApplications/CampaignPerformanceTracking/CampaignPerformanceTracking/bin/Oracle.DataAccess.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Major
Version ERR: Failed to complete setup of assembly (hr = 0x80131040).
Probing terminated.
Stack Trace:
[FileLoadException: Could not load file or assembly
'Oracle.DataAccess, Version=2.122.1.0, Culture=neutral,
PublicKeyToken=89b483f429c47342' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)]
CampaignPerformanceTracking.JobSearch..ctor() in
c:\TFS\IVAS\CPTSBaselineCode\FrontEndApplications\CampaignPerformanceTracking\CampaignPerformanceTracking\JobSearch.aspx.cs:25
ASP.jobsearch_aspx..ctor() in
c:\Users\XXX\AppData\Local\Temp\1\Temporary ASP.NET
Files\vs\ecf130a4\7d736bb0\App_Web_xghf0hzg.3.cs:0
__ASP.FastObjectFactory_app_web_xghf0hzg.Create_ASP_jobsearch_aspx() in c:\Users\XXX\AppData\Local\Temp\1\Temporary ASP.NET
Files\vs\ecf130a4\7d736bb0\App_Web_xghf0hzg.4.cs:0
System.Web.Compilation.BuildResultCompiledType.CreateInstance() +31
System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath
virtualPath, Type requiredBaseType, HttpContext context, Boolean
allowCrossApp) +100
System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context,
String requestType, VirtualPath virtualPath, String physicalPath) +31
System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext
context, String requestType, VirtualPath virtualPath, String
physicalPath) +64
System.Web.HttpApplication.MapHttpHandler(HttpContext context, String
requestType, VirtualPath path, String pathTranslated, Boolean
useAppConfig) +191
System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+156 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +48 System.Web.HttpApplication.ExecuteStep(IExecutionStep
step, Boolean& completedSynchronously) +159
It is a bit difficult to help you if we see only the error message and nothing else. Some points:
Which version of .NET framework did you set in your compile options? If you set 3.5 or lower then your application tries to load Oracle.DataAccess.dll 2.xxx. If you set 4.0 or higher then Oracle.DataAccess.dll 4.xxx will be loaded.
The architecture (i.e. 32-bit or 64-bit) of Oracle.DataAccess.dll must be the same as the architecture if your application
Did you install Oracle.DataAccess.dll (Oracle Data Provider for .NET)? - it is not included in Oracle Instant Client by default.
Version of Oracle.DataAccess.dll must be exactly the same version as your Oracle Client
Oracle installer 12.1 or newer does not add Oracle.DataAccess.dll to GAC. You must add it manually.
While migrating from mq dot client 1.0 to mq 8.0.0.4, receiving following error when call mq manager is made.
call is made from a script task from ssis 2012 package. call to mq manager works when called from a windows service.
Inner Exception :
System.IO.FileLoadException: Could not load file or assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Either a required impersonation level was not provided, or the provided impersonation level is invalid. (Exception from HRESULT: 0x80070542)
File name: 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ---> System.IO.FileLoadException: Could not load file or assembly 'System.Web`enter code here`, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Either a required impersonation level was not provided, or the provided impersonation level is invalid. (Exception from HRESULT: 0x80070542)
File name: 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
=== Pre-bind state information ===
LOG: DisplayName = System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
(Fully-specified)
LOG: Appbase = file:///C:/Program Files/Microsoft SQL Server/110/DTS/Binn/
LOG: Initial PrivatePath = NULL
Calling assembly : amqmdnet, Version=9.0.0.3, Culture=neutral, PublicKeyToken=dd3cb1c9aae9ec97.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files\Microsoft SQL Server\110\DTS\Binn\DTExec.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Version redirect found in framework config: 2.0.0.0 redirected to 4.0.0.0.
LOG: Post-policy reference: System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
at IBM.WMQ.CommonServices.GetPropertyValue(String propertyName, Boolean tryEnvironment)
at IBM.WMQ.CommonServices.CreateCommonServices()
at IBM.WMQ.CommonServices.TraceConstructor(String objectId, String sccsid)
at IBM.WMQ.Nmqi.NmqiEnvironment..ctor(NmqiPropertyHandler nmqiPropertyHandler)
at IBM.WMQ.Nmqi.NmqiFactory.GetInstance(NmqiPropertyHandler properties)
at IBM.WMQ.MQQueueManager..cctor()
Stack Trace :
at IBM.WMQ.MQQueueManager..ctor(String queueManagerName, Hashtable properties)
at CIBC.CTS.PMI.MQ.MQConnection.Connect(String hostName, Int32 port, String queueManagerName, String channelName, String replyQueueManagerName, String mqIdentity)
Message :
The type initializer for 'IBM.WMQ.MQQueueManager' threw an exception.
Source :
amqmdnet
Edit: have tried installing version 9.0.0.3 too as 8.0.0.4 had know issue with unmanaged code calling mq, but that did not work.
could this issue be due to version redirector as per the binding log?
LOG: Version redirect found in framework config: 2.0.0.0 redirected to 4.0.0.0.
Or related to Impersonation from SSIS script task? Impersonaltion level is shown as "Identification"
We are migrating a Silverlight4 application developed in visual studio 2010 with active directory single sign on to Silverlight 5 for visual studio 2013.
After replacing some .dll's like toolkit and data visualization toolkit and other dll without changing the framework(4.0) it was working fine but When I am changing the active directory project framework from 3.5 to 4.0 or higher it is throwing the following errors:
Error 71 The type name 'RoleProvider' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.
Error 73 The type name 'MembershipUser' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.
Error 74 The type name 'MembershipUser' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.
Error 75 The type name 'MembershipUser' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.
Error 76 The type name 'MembershipUser' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.
Error 78 The type name 'MembershipUser' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.
Error 77 The type name 'MembershipCreateStatus' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.
Error 72 The type 'System.Web.Security.MembershipProvider' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
I tried replacing the assemblies and namespaces but no luck. Does anyone came across this kind of issues. I would appreciate your help if you could give me a solution. thank you very much
remove the existing reference to System.Web.ApplicationServices.dll and refer System.Web.ApplicationServices with version 4.0.0.0.. or higher
You can find it in a folder that might look like C:\Windows\Microsoft.NET\Framework64\v4.0.30319
I have a visual studio windoes application having N Number of projects.
I am getting the below described error while running my setup.
this error is traced by Fusion log viewer:-
> The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable C:\Program Files (x86)\directory\InstallUtil.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = userdir\Alice.Carroll
LOG: DisplayName = Company.Shared.EnterpriseLibraryExtensions.resources, Version=2.0.0.0, Culture=en, PublicKeyToken=80955c93367666f4
(Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/directory/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files (x86)\directory\InstallUtil.exe.Config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: Company.Shared.EnterpriseLibraryExtensions.resources, Version=2.0.0.0, Culture=en, PublicKeyToken=80955c93367666f4
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/directory/en/Company.Shared.EnterpriseLibraryExtensions.resources.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/directory/en/Company.Shared.EnterpriseLibraryExtensions.resources/Company.Shared.EnterpriseLibraryExtensions.resources.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/directory/en/Company.Shared.EnterpriseLibraryExtensions.resources.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/directory/en/Company.Shared.EnterpriseLibraryExtensions.resources/Company.Shared.EnterpriseLibraryExtensions.resources.EXE.
LOG: All probing URLs attempted and failed.
What may be the cause of this error?
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.WMPLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Source=kn diary
StackTrace:
at kn_diary.My.MyProject.MyForms.Create_Instance_[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190
at kn_diary.My.MyProject.MyForms.get_Form1()
at kn_diary.My.MyApplication.OnCreateMainForm() in C:\Users\Pak\Desktop\project\kn diary\kn diary\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 kn_diary.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.BadImageFormatException
Message=Could not load file or assembly 'Interop.WMPLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Source=AxInterop.WMPLib
FileName=Interop.WMPLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
FusionLog==== Pre-bind state information ===
LOG: User = Pak-PC\Pak
LOG: DisplayName = Interop.WMPLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///C:/Users/Pak/Desktop/project/kn diary/kn diary/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : AxInterop.WMPLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Pak\Desktop\project\kn diary\kn diary\bin\Debug\kn diary.vshost.exe.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\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:/Users/Pak/Desktop/project/kn diary/kn diary/bin/Debug/Interop.WMPLib.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
StackTrace:
at AxWMPLib.AxWindowsMediaPlayer.AttachInterfaces()
at System.Windows.Forms.AxHost.GetOcxCreate()
at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
at System.Windows.Forms.AxHost.CreateHandle()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.AxHost.EndInit()
at kn_diary.Form1.InitializeComponent() in C:\Users\Pak\Desktop\project\kn diary\kn diary\Form1.designer.vb:line 91
at kn_diary.Form1..ctor()
InnerException:
This is an indication of failure to load one of the reference assemblies in the chain of references, in this case, an indirect reference. I normally check the fusion log to find out exactly what assembly is failing to load and often why.
Can you check the fusion log and paste the log here in case if you do not already spot the culprit there? You can lunch logger by running "fuslogvw.exe" from VS command prompt. (this link has more detail on how to use the fusion log viewer: http://msdn.microsoft.com/en-us/library/e74a18c4(v=vs.80).aspx)