Tag: fileloadexception

在另一台计算机上运行C#程序时出现System.IO.FileLoadException

我目前正在开发一个C#WPF项目,该项目使用MySQL.Data和System.Data.Sqlite dll以及其他几个。 该项目是一个.Net 4项目,在我的开发机器上没有问题。 我创建了一个MSI安装程序包,当我添加可执行文件Visual Studio时,计算出依赖项,并在EXE中添加所需的DLL。 当我在我的开发机器上运行安装程序时,一切正常。 但是,当我将安装程序复制到安装了.Net Framework 3.5和.Net Framework 4的空白虚拟机时,安装程​​序说已经成功安装了所有内容,当我查看程序文件文件夹时,所有的DLL都在那里,但是当我尝试运行软件未加载的软件,并在事件查看器中显示.Net Runtime错误。 错误如下 应用程序:MySQLBackup.exe Framework版本:v4.0.30319描述:由于未处理的exception,进程终止。 exception信息:System.IO.FileLoadException Stack:位于System.Windows.Application的System.Windows.Application.OnStartup(System.Windows.StartupEventArgs)的MySQLBackup.App.Application_Startup(System.Object,System.Windows.StartupEventArgs)。位于MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen的System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate,System.Object,Int32)中的.ctor> b__1(System.Object)(System.Object,System.Delegate,System位于System.Whows.Threading.Threading.DepatcherOseration上的System.Windows.Threading.DispatcherOperation.InvokeImpl()处的System.Threading.ExecutionContext.runTryCode(System.Object)处的System.Windows.Threading.DispatcherOperation.InvokeImpl()处于.Object,Int32,System.Delegate。 System.Threading.ExecutionContext上的System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext,System.Threading.ContextCallback,System.Object)中的System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode,CleanupCode,System.Object) System.Windows上的System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,System.Threading.ContextCallback,System.Object)中的.Run(System.Threading.ExecutionContext,System.Threading.ContextCallback,System.Object,Boolean) .Threading.DispatcherOperation.Invoke()在MS.Win32.HwndWrapper.WndProc的System.Windows.Threading.Dispatcher.WndProcHook(IntPtr,Int32,IntPtr,IntPtr,Boolean ByRef)的System.Windows.Threading.Dispatcher.ProcessQueue()处。 (IntPtr,Int32,IntPtr,IntPtr,Boolean ByRef)位于MS.Internal的System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate,System.Object,Int32)中的MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object) System.Windows.Threading.Dispatcher.InvokeImpl中的.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object,System.Delegate,System.Object,Int32,System.Delegate)(System.Windows.Threading.DispatcherPriority,System.TimeSpan,System。委托,System.Object,Int32)在MS.Win32.HwndSubclass.SubclassWndProc System.Windows上System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)的MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)上的(IntPtr,Int32,IntPtr,IntPtr) System.Windows.Application.RunInternal(系统中的System.Windows.Application.RunDispatcher(System.Object)上的System.Windows.Threading.Dispatcher.Run()中的.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame) .Windows.Window)位于System.Windows.Application.Run(System.Windows.Window)的System.Windows.Application.Run(),位于MySQLBackup.App.Main() 错误消息并没有真正帮助我找出错误所以在Application Start up事件中我添加了try catch语句但是exception永远不会被捕获。 我还在InitialiseComponent()方法中添加了try catch,它在应该加载的第一个对话窗口上执行,但是再次捕获的东西永远不会被捕获,所以我看不出导致错误的原因。 我怎样才能弄清楚这个问题是什么并修复它?

无法加载文件或程序集Microsoft.Win32.Primitives,Version = 4.0.0.0

我在运行我的Web应用程序时遇到问题。 项目设置是ASP.NET Core Web应用程序(.NET Framework)。 我似乎没有得到任何Build错误。 该项目不仅仅是运行。 System.IO.FileLoadException:’无法加载文件或程序集’Microsoft.Win32.Primitives,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a’或其依赖项之一。 定位的程序集的清单定义与程序集引用不匹配。 (来自HRESULT的exception:0x80131040)’

System.IO.FileLoadException:无法加载文件或程序集Log4net

我在解决方案中添加了一个现有项目。 当我使用MSTest运行程序运行所有unit testing时,我在几个测试中得到以下错误: 消息:测试方法soandso引发exception:System.IO.FileLoadException:无法加载文件或程序集’log4net,版本1.2.12.0,Culture = neutral,PublicKeyToken = 669e0ddf0bb1aa2a’或其中一个依赖项。 定位的程序集的清单定义与程序集引用不匹配。 (HRESULTexception:0x80131040) 我知道其他人也有同样的问题,关于这个话题还有其他问题和答案。 但我尝试了很多东西,但没有任何帮助。 我们使用的log4net版本是1.2.13.0。 我检查了FUSLOGVW.exe是否存在绑定错误。 log4net显示添加的程序集和一些未知程序集。 程序集中log4net的引用显示了随NuGet添加的1.2.13.0版本。 所以它可能是一个依赖程序集导致所有这些麻烦。 我尝试将log4net更改回版本1.2.12.0,但我仍然收到相同的错误消息。 当我使用MSTest testrunner运行所有测试时,会出现这些错误。 当我只运行失败的测试时,它们会通过。 当我单独运行它们时,它们也会通过。 我尝试了绑定重定向,但我是为测试而不是测试程序集的程序集做的。 我不知道如何为测试程序集做到这一点 – 没有配置。 当我使用Resharper测试运行器运行测试时,它们也会通过(但其他测试失败)。 TFS Build服务器运行MSTest-runner,因此我需要使用MSTest。 有谁知道如何解决这个问题?

为什么我得到System.IO.FileLoadException:无法加载文件或程序集,大约每周一次在我的ASP.Net网站上?

我有一个相当简单的内部ASP.Net网站,每周大约加载一次Microsoft.Practices.EnterpriseLibrary.Data dll。 这是Exception消息: System.IO.FileLoadException: Could not load file or assembly ‘Microsoft.Practices.EnterpriseLibrary.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. Access is denied. File name: ‘Microsoft.Practices.EnterpriseLibrary.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null’ at foobar.Intranet.Logic.Data.UserDB.SelectByUserName(String userName) at foobar.Intranet.Logic.Info.User.ValidateUser(String userName) in F:\Development\foobar\foobar\foobar.Intranet.Logic\Info\User.cs:line 130 at Login.ValidateUser(String username, String password) in e:\foobar\foobar.Intranet\Login.aspx.cs:line 32 === Pre-bind state information === LOG: User = Unknown LOG: […]