gpt4 book ai didi

c# - 检测到绑定(bind)失败 'Microsoft.Practices.EnterpriseLibrary.Validation'

转载 作者:太空狗 更新时间:2023-10-29 20:46:55 24 4
gpt4 key购买 nike

这个项目的构建是在我 friend 的电脑上进行的,但不是在我的电脑上。

在这条返回线上:

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 inthe 'Load' binding context of the AppDomain with ID 1. The cause ofthe failure was: System.IO.FileNotFoundException: Could not load fileor assembly 'Microsoft.Practices.EnterpriseLibrary.Validation' or oneof its dependencies. The system cannot find the file specified. Filename: '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/MyDocuments/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\MyDocuments\Projects\BulkUploadToLOMDatabase\BulkUploadToLOMDatabase\bin\Debug\BulkUploadToLOMDatabase.vshost.exe.configLOG: Using machine configuration file fromc:\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: Attemptingdownload of new URL file:///C:/Documents and Settings/agordon/MyDocuments/Projects/BulkUploadToLOMDatabase/BulkUploadToLOMDatabase/bin/Debug/Microsoft.Practices.EnterpriseLibrary.Validation.DLL.LOG: Attempting download of new URL file:///C:/Documents andSettings/agordon/MyDocuments/Projects/BulkUploadToLOMDatabase/BulkUploadToLOMDatabase/bin/Debug/Microsoft.Practices.EnterpriseLibrary.Validation/Microsoft.Practices.EnterpriseLibrary.Validation.DLL.LOG: Attempting download of new URL file:///C:/Documents andSettings/agordon/MyDocuments/Projects/BulkUploadToLOMDatabase/BulkUploadToLOMDatabase/bin/Debug/Microsoft.Practices.EnterpriseLibrary.Validation.EXE.LOG: Attempting download of new URL file:///C:/Documents andSettings/agordon/MyDocuments/Projects/BulkUploadToLOMDatabase/BulkUploadToLOMDatabase/bin/Debug/Microsoft.Practices.EnterpriseLibrary.Validation/Microsoft.Practices.EnterpriseLibrary.Validation.EXE.

这是我所有的引用资料:

enter image description here

我确实下载并安装了最新的企业库,并将上图中的所有 DLLS 替换为所有更新版本。

我做错了什么?

最佳答案

好的,我找到了解决方案。我永远无法接受关闭异常作为答案。只是似乎有点不对……

似乎正在发生的事情是,在以前的程序集中,或当前程序集的以前版本中,某些引用在外部使用。即使您的代码可能早已放弃这些引用,但仍会在程序集中搜索这些名称(在某处有些神秘)。

转到您的 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))]

并保持你的异常开启!我将针对类似性质的各种问题发布此答案。

关于c# - 检测到绑定(bind)失败 'Microsoft.Practices.EnterpriseLibrary.Validation',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6698147/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com