2011-07-14 57 views
5

该项目的建设正在我的朋友的计算机上工作,但没有在我的电脑上工作。检测到绑定失败'Microsoft.Practices.EnterpriseLibrary.Validation'

这一回线

protected static Database Connection2 
{ 
    get 
    { 
     try 
     { 
      return DatabaseFactory.CreateDatabase("HermesDB"); 
     } 
     catch (Exception e) 
     { 
      //Corpnet.Elmah.Error.Add(e); 
      return null; 
     } 
    } 
} 

我收到以下错误:

The assembly with display name 'Microsoft.Practices.EnterpriseLibrary.Validation' failed to load in the 'Load' binding context of the AppDomain with ID 1. The cause of the failure was: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Validation' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.Practices.EnterpriseLibrary.Validation'

=== Pre-bind state information === LOG: User = MLABS\agordon LOG: DisplayName = Microsoft.Practices.EnterpriseLibrary.Validation (Partial) LOG: Appbase = file:///C:/Documents and Settings/agordon/My Documents/Projects/BulkUploadToLOMDatabase/BulkUploadToLOMDatabase/bin/Debug/ LOG: Initial PrivatePath = NULL Calling assembly : Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=null. === LOG: This bind starts in default load context. LOG: Using application configuration file: C:\Documents and Settings\agordon\My Documents\Projects\BulkUploadToLOMDatabase\BulkUploadToLOMDatabase\bin\Debug\BulkUploadToLOMDatabase.vshost.exe.config 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:/Documents and Settings/agordon/My Documents/Projects/BulkUploadToLOMDatabase/BulkUploadToLOMDatabase/bin/Debug/Microsoft.Practices.EnterpriseLibrary.Validation.DLL. LOG: Attempting download of new URL file:///C:/Documents and Settings/agordon/My Documents/Projects/BulkUploadToLOMDatabase/BulkUploadToLOMDatabase/bin/Debug/Microsoft.Practices.EnterpriseLibrary.Validation/Microsoft.Practices.EnterpriseLibrary.Validation.DLL. LOG: Attempting download of new URL file:///C:/Documents and Settings/agordon/My Documents/Projects/BulkUploadToLOMDatabase/BulkUploadToLOMDatabase/bin/Debug/Microsoft.Practices.EnterpriseLibrary.Validation.EXE. LOG: Attempting download of new URL file:///C:/Documents and Settings/agordon/My Documents/Projects/BulkUploadToLOMDatabase/BulkUploadToLOMDatabase/bin/Debug/Microsoft.Practices.EnterpriseLibrary.Validation/Microsoft.Practices.EnterpriseLibrary.Validation.EXE.

这里所有的引用我有:

enter image description here

我没有下载最新的企业库和安装它,我取代了所有的DL上图中的LS将全部更新它们的版本。

我在做什么错?

+0

你的配置文件有一个ref。到任何旧的DLL? –

回答

10

好吧我找到了解决方案。我绝不会接受关闭例外作为答案。只是似乎有点错......

似乎正在发生的是,在以前的程序集,或当前程序集的以前的版本中,某些引用是外部使用的。尽管你的代码可能早就放弃了这些引用,但是这些名字在某个地方仍然有些神秘,正在被搜索到。

转到您的AssemblyInfo.cs文件并找到ThemeInfo:

[assembly: ThemeInfo(
ResourceDictionaryLocation.ExternalAssembly, //where theme specific resource dictionaries are located 
//(used if a resource is not found in the page, 
// or application resource dictionaries) 
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 
//(used if a resource is not found in the page, 
// app, or any theme specific resource dictionaries))] 

变化的第一个位置为 '无':

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 
//(used if a resource is not found in the page, 
// or application resource dictionaries) 
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 
//(used if a resource is not found in the page, 
// app, or any theme specific resource dictionaries))] 

,并保持你的例外开启!我会将这个答案发布到这个类似性质的各种问题上。

6

这不是一个致命错误;它是一个托管调试助手,提醒您潜在的问题。
转到调试,例外并取消选中它。

您也可以直接按F5继续执行。

+0

谢谢!!!!!!!!!!!!!!!!!!!!!!!! –

+0

有一个真棒shabbas –

+0

复选框已禁用我怎么能取消选中它? –

1

清洁/bin文件夹帮我解决这个问题

0

绑定失败修复:在Visual Studio 2015年 - >选项卡调试 - > Windows的>异常设置 - >输出以下右下角的设置板 - >托管调试助理 - >取消检查BindingFailure