无法加载文件或程序集不支持该操作。 (来自HRESULT的异常:0x80131515) [英] Could not load file or assembly Operation is not supported. (Exception from HRESULT: 0x80131515)

查看:601
本文介绍了无法加载文件或程序集不支持该操作。 (来自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'或
其依赖项之一。不支持该操作。 (来自
HRESULT的异常:0x80131515)

error : Could not load file or assembly 'file:///C:\foobar.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

为什么/不支持什么?

推荐答案

在研究过程中,我发现在您从互联网上以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论坛

所以我编辑了文件


C:\Program Files(x86)\Microsoft Visual Studio
11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe.config

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.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.

也许这可以帮助其他也遇到这种奇怪问题的用户ue。

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

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

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆