本文介绍了无法加载文件或程序集 不支持操作.(来自 HRESULT 的异常:0x80131515)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我从一个小型控制台工具通过 vstest.console.exe 从计划任务中运行 CodedUI 测试时,我有时会在不同的 PC 上看到此错误消息:

When I run CodedUI Test from a small Console tool via vstest.console.exe from a scheduled task I sometimes see this error message on different PCs:

错误:无法加载文件或程序集file:///C:foobar.dll"或它的依赖项之一.不支持操作.(例外来自结果:0x80131515)

为什么/什么不受支持?

Why/what is this not supported?

推荐答案

在我的研究中我发现 当您从 Internet 下载 ZIP 中的测试并且建议解除阻止 ZIP 时,可能会发生这种情况.但是我通过网络将文件从我的开发人员系统复制到测试 PC 并且文件没有被阻止.

During my research I found that this may happen when you downloaded a test in a ZIP from the internet and the advice was to unblock the ZIP. But I copied the files over the network from my developer system to the test PCs and the files were not blocked.

搜索更多错误代码 0x80131515 我在 MSDN 论坛中找到了这个答案.

Searching more for the error code 0x80131515 I found this answer in the MSDN forum.

所以我编辑了文件

C:Program Files (x86)Microsoft Visual Studio11.0Common7IDECommonExtensionsMicrosoftTestWindowvstest.console.exe.config

并在运行时标签下添加了条目 <loadFromRemoteSources enabled="true"/> 并且瞧,测试运行良好,没有任何计划任务的问题.

and added the entry <loadFromRemoteSources enabled="true" /> under the runtime tag and voilá, the tests run fine without any issues from a scheduled task.

也许这有助于其他也遇到这个奇怪问题的用户.

Maybe this helps other users who also run into this strange issue.

这篇关于无法加载文件或程序集 不支持操作.(来自 HRESULT 的异常:0x80131515)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-04 16:41