从今天开始,我在一个我已经工作了几个月并且一直有效的项目中遇到了这个错误。
我尝试清理解决方案并重建,并且构建工作完美。
我尝试重新启动 VS 和 PC,但没有任何效果。
所以问题不在代码中
无法加载文件或程序集“xxx.Data”或其依赖项之一。该进程无法访问该文件,因为该文件正在被另一个进程使用。 (HRESULT 异常:0x80070020)
描述:执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其在代码中的来源的更多信息。
异常详细信息:System.IO.FileLoadException:无法加载文件或程序集“xxx.Data”或其依赖项之一。该进程无法访问该文件,因为该文件正在被另一个进程使用。 (HRESULT 异常:0x80070020)
来源错误:
执行当前 Web 请求期间生成未处理的异常。有关异常来源和位置的信息可以使用下面的异常堆栈跟踪来识别。
程序集加载跟踪:以下信息有助于确定程序集“xxx.Data”无法加载的原因。
=== Pre-bind state information ===
LOG: DisplayName = xxx.Data
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: xxx.Data | Domain ID: 2
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Proyectos/xxx/xxx/
LOG: Initial PrivatePath = C:\Proyectos\xxx\xxx\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Proyectos\xxx\xzxx\web.config
LOG: Using host configuration file: C:\Users\Esteban\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\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/Esteban/AppData/Local/Temp/Temporary ASP.NET Files/root/8076610e/464a474/xxx.Data.DLL.
LOG: Attempting download of new URL file:///C:/Users/Esteban/AppData/Local/Temp/Temporary ASP.NET Files/root/8076610e/464a474/xxx.Data/xxx.Data.DLL.
LOG: Attempting download of new URL file:///C:/Proyectos/xxx/xxx/bin/xxx.Data.DLL.
LOG: Using application configuration file: C:\Proyectos\xxx\xxx\web.config
LOG: Using host configuration file: C:\Users\Esteban\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
ERR: Failed to complete setup of assembly (hr = 0x80070020). Probing terminated.
正如消息所述,该文件正在使用中。这不是 Visual Studio 或 .NET 的问题,而是操作系统的问题。
另一个程序正在使用该文件,它可以是病毒扫描程序、另一个正在运行的应用程序,甚至是 Visual Studio(有时调试器会锁定文件)。
当您尝试删除或重命名文件时,Windows 会告诉您哪个程序负责锁定。我建议这样做以查看哪个程序正在锁定您的文件。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)