无法加载文件或程序集“Microsoft.QualityTools.Testing.Fakes”或其依赖项之一

Could not load file or assembly 'Microsoft.QualityTools.Testing.Fakes' or one of its dependencies

提问人:starlin moses 提问时间:11/28/2022 最后编辑:GregCstarlin moses 更新时间:11/28/2022 访问量:241

问:

这发生在 Visual Studio 2022 社区版中。

System.IO.FileLoadException: Could not load file or assembly 'Microsoft.QualityTools.Testing.Fakes' or one of its dependencies. Access is denied. File name: 'Microsoft.QualityTools.Testing.Fakes'
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)    at System.Reflection.Assembly.Load(String assemblyString)
at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. 
Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

尝试创建删除Fakes文件夹并重建我的解决方案。无。 创建 [HKLM\Software\Microsoft\Fusion!EnableLog]只是提供了错误的更多详细信息。

visual-studio 测试 visual-studio-2022 平等 访问被拒绝

评论


答:

1赞 starlin moses 11/28/2022 #1

发现我的解决方案版本尝试创建 microsoft.qualitytools.testing.fakes,但 bin 文件夹中已经有一个 dll。删除了它,构建工作正常。