You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Visual Studio 2022社区版加载Microsoft.QualityTools.Testing.Fakes程序集失败

Visual Studio 2022社区版:Microsoft.QualityTools.Testing.Fakes加载权限拒绝问题

错误详情

System.IO.FileLoadException: 无法加载文件或程序集“Microsoft.QualityTools.Testing.Fakes”或其某一个依赖项。访问被拒绝。文件名: “Microsoft.QualityTools.Testing.Fakes”
在 System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
在 System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
在 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
在 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
在 System.Reflection.Assembly.Load(String assemblyString)
在 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
警告: 程序集绑定日志记录已关闭。要启用程序集绑定失败日志记录,请将注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) 设置为 1。
注意: 与程序集绑定失败日志记录关联的性能损失。要关闭此功能,请移除注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog]。

已尝试无效操作

  • 删除Fakes文件夹并重建解决方案
  • 创建HKLM\Software\Microsoft\Fusion!EnableLog注册表项(仅获取更多错误细节,未解决问题)

解决方法

  • 以管理员身份运行Visual Studio:右键Visual Studio图标选择「以管理员身份运行」,重新加载项目。
  • 检查程序集权限:找到Microsoft.QualityTools.Testing.Fakes所在路径(通常在Visual Studio安装目录Common7\IDE\PublicAssemblies或项目packages文件夹),右键文件选「属性」-「安全」,确认当前用户有读取和执行权限。
  • 修复Visual Studio安装:打开Visual Studio安装程序,选择「修改」-「修复」,修复损坏组件或缺失依赖。
  • 清理NuGet缓存并重装依赖:
    1. 打开NuGet包管理器控制台,执行命令:nuget locals all -clear
    2. 右键项目选「管理NuGet程序包」,卸载并重新安装相关Fakes包。
  • 检查项目框架兼容性:确认项目目标.NET框架版本与Microsoft.QualityTools.Testing.Fakes支持版本匹配,不匹配则调整项目框架。

内容的提问来源于stack exchange,提问作者starlin moses

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.11 02:15:36