Could not load file or assembly'System.EnterpriseServices'

本文解决了在尝试连接SQL Server Express 2005时遇到的'System.EnterpriseServices'文件或组件加载失败的问题。通过重新安装未能解决问题后,提供了一种解决方案:将特定版本的System.EnterpriseServices.dll文件从.NET Framework目录移动到assembly目录。

    Could not load file or assembly'System.EnterpriseServices'...... when I try to connect to the SQL Server Express 2005. 

Could not load file or assembly 'System.EnterpriseServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Systemet could not find the file.

    I  reinstall the SQL Server Express again, but it still have this problem.

    The solution is as follow:

    drag the file at
"<windows_directory>/Microsoft.NET/Framework/v2.0<your_subversion>/System.EnterpriseServices.dll"
to the "<windows_directory>/assembly/" folder.

    Before that just check the properties of the file to be sure it has the appropriate version number.

System.IO.FileNotFoundException: Could not find file "/Users/zhoufeng/mmzhu/ET-release8.1/Unity/Assets/Bundles/Code/Unity.Model.dll.bytes" File name: '/Users/zhoufeng/mmzhu/ET-release8.1/Unity/Assets/Bundles/Code/Unity.Model.dll.bytes' at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in <ffede847aa21468d8e163d4cea4bee49>:0 at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize) [0x00000] in <ffede847aa21468d8e163d4cea4bee49>:0 at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int) at System.IO.File.ReadAllBytes (System.String path) [0x00000] in <ffede847aa21468d8e163d4cea4bee49>:0 ET.CodeLoader.Start () [0x000d8] /Users/zhoufeng/mmzhu/ET-release8.1/Unity/Assets/Scripts/Loader/CodeLoader.cs:62 ET.Init.StartAsync () [0x001e0] /Users/zhoufeng/mmzhu/ET-release8.1/Unity/Assets/Scripts/Loader/MonoBehaviour/Init.cs:41 ET.ETTask.GetResult () [0x00030] /Users/zhoufeng/mmzhu/ET-release8.1/Unity/Assets/Scripts/ThirdParty/ETTask/ETTask.cs:126 ET.ETTask.InnerCoroutine () [0x00018] /Users/zhoufeng/mmzhu/ET-release8.1/Unity/Assets/Scripts/ThirdParty/ETTask/ETTask.cs:71 UnityEngine.Debug:LogError (object) ET.UnityLogger:Error (string) (at Assets/Scripts/Loader/UnityLogger.cs:33) ET.Log:Error (System.Exception) (at Assets/Scripts/Core/World/Module/Log/Log.cs:76) ET.AsyncETVoidMethodBuilder:SetException (System.Exception) (at Assets/Scripts/ThirdParty/ETTask/AsyncETVoidMethodBuilder.cs:33) ET.ETTask/<InnerCoroutine>d__10:MoveNext () (at Assets/Scripts/ThirdParty/ETTask/ETTask.cs:71) ET.StateMachineWrap`1<ET.ETTask/<InnerCoroutine>d__10>:Run () (at Assets/Scripts/ThirdParty/ETTask/StateMachineWrap.cs:56) ET.ETAsyncTaskMethodBuilder:SetException (System.Exception) (at Assets/Scripts/ThirdParty/ETTask/AsyncETTaskMethodBuilder.cs:35) ET.Init/<StartAsync>d__1:MoveNext () (at Assets/Scripts/Loader/MonoBehaviour/Init.cs:41) ET.StateMachineWrap`1<ET.Init/<StartAsync>d__1>:Run () (at Assets/Scripts/ThirdParty/ETTask/StateMachineWrap.cs:56) ET.ETTask:SetResult () (at Assets/Scripts/ThirdParty/ETTask/ETTask.cs:145) ET.ETAsyncTaskMethodBuilder:SetResult () (at Assets/Scripts/ThirdParty/ETTask/AsyncETTaskMethodBuilder.cs:47) ET.ResourcesComponent/<CreatePackageAsync>d__2:MoveNext () (at Assets/Scripts/Loader/Resource/ResourcesComponent.cs:85) ET.StateMachineWrap`1<ET.ResourcesComponent/<CreatePackageAsync>d__2>:Run () (at Assets/Scripts/ThirdParty/ETTask/StateMachineWrap.cs:56) System.Threading.Tasks.TaskCompletionSource`1<object>:TrySetResult (object) YooAsset.AsyncOperationBase:SetFinish () (at ./Library/PackageCache/com.tuyoogame.yooasset@2.1.1/Runtime/OperationSystem/AsyncOperationBase.cs:111) YooAsset.OperationSystem:Update () (at ./Library/PackageCache/com.tuyoogame.yooasset@2.1.1/Runtime/OperationSystem/OperationSystem.cs:83) YooAsset.YooAssets:Update () (at ./Library/PackageCache/com.tuyoogame.yooasset@2.1.1/Runtime/YooAssets.cs:84) YooAsset.YooAssetsDriver:Update () (at ./Library/PackageCache/com.tuyoogame.yooasset@2.1.1/Runtime/YooAssetsDriver.cs:13) 报错
07-02
在C# Windows Forms应用程序打开时弹出“Could not load file or assembly ..”报警问题,通常与程序集加载失败有关,以下是一些可能的解决办法: ### 检查DLL文件是否存在 确认报错信息中提及的DLL文件确实存在于指定的路径。若使用相对路径引用DLL,要保证DLL文件处于正确的目录。例如,若在Debug目录下运行程序,DLL文件应位于该Debug目录。 ### 检查DLL版本 确保引用的DLL版本和应用程序兼容。有时候,DLL版本不匹配会引发加载失败的问题。可以尝试重新引用正确版本的DLL。 ### 检查引用设置 在Visual Studio里,检查项目的引用设置。右键点击项目,选择“添加” -> “引用”,查看引用的DLL是否存在错误或缺失的情况。若有问题,移除并重新添加引用。 ### 加载DLL的代码检查 若使用代码动态加载DLL,像使用`Assembly.Load`方法,要确保代码逻辑无误。参考添加Invoke方法来进行对DLL中方法的调用的代码逻辑,保证已加载的DLL不会重复加载,若未加载或者要加载不同的DLL则进行加载: ```csharp // 示例代码,根据实际情况修改 using System; using System.Reflection; public class DLLLoader { private static Assembly MyAssembly; public static void InvokeDLLMethod() { string dllPath = "YourDLLPath.dll"; if (MyAssembly == null || MyAssembly.FullName != AssemblyName.GetAssemblyName(dllPath).FullName) { MyAssembly = Assembly.LoadFrom(dllPath); } // 后续调用DLL中的方法 } } ``` ### 权限问题 确保应用程序有访问DLL文件的权限。有时候,文件权限不足会导致加载失败。可以尝试以管理员身份运行Visual Studio或者应用程序。 ### 依赖项检查 某些DLL可能依赖其他的DLL,要确保所有依赖的DLL都存在且版本兼容。可以使用工具(如Dependency Walker)来检查DLL的依赖关系。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值