teamcity - 为什么在 TeamCity 上运行 MSpec 时会收到 NotSupportedException?

标签 teamcity mspec

在 TeamCity 中运行 MSpec 构建步骤时,我在团队城市日志中收到以下错误:

[Step 7/7] Starting: C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe #TeamCityImplicit
[17:07:13][Step 7/7] in directory: C:\TeamCity\buildAgent\work\726e90173bc65483
[17:07:14][Step 7/7] 2012-10-02 17:07:14,471 [4332] ERROR JetBrains.TeamCity.Utils.Runtime.ParseUtil - Failed to load assembly from file c:\mspec\mspec.exe: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.
[17:07:14][Step 7/7] System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.
[17:07:14][Step 7/7]    at System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence)
[17:07:14][Step 7/7]    at System.Reflection.Assembly.LoadFile(String path)
[17:07:14][Step 7/7]    at JetBrains.TeamCity.Utils.Runtime.ParseUtil.LoadAssembly(String value) in c:\BuildAgent\work\e6509710c0972c73\src\Utils\src\Runtime\ParseUtil.cs:line 110

我已对 machine.config 和 MSpec 配置文件进行了建议的修改,但似乎没有帮助。

<runtime>         
  <loadFromRemoteSources enabled="true"/>
</runtime>

MSpec 运行程序正在引用构建代理上本地编译的 DLL,该代理在 Visual Studio 中本地正确运行。谁能解释这个错误的含义以及我如何解决它?

最佳答案

你能检查一下mspec.exe或“编译的DLL”的属性来看看是否有security Unblock button 。我遇到了同样的错误,Unblock 修复了它。启用 loadFromRemoteSources 没有帮助。

关于teamcity - 为什么在 TeamCity 上运行 MSpec 时会收到 NotSupportedException?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12694172/

相关文章:

C# 在我的单元测试中我想看看它是 null 还是空字符串

c# - 为什么 ReSharper 8 测试运行程序会在此规范上崩溃?

c# - 如何使用 MSpec 有效地测试固定长度的平面文件解析器?

api - TeamCity - 你如何通过rest api获得每个项目最后完成构建的列表?

deployment - 使用 TeamCity,如何针对先前构建和测试的构建运行手动触发 DEPLOY?

teamcity - 测试自动化-TeamCity +葫芦+ JIRA + SpiraTest

带有 postgresql 和 redis 的 Docker 镜像

resharper - MSpec 和 ReSharper 问题

c# - 使用 MSpec 比较两个列表

iis - 在 TeamCity 分支移除时通过 Octopus Deploy 自动清理 IIS 站点