我正在尝试将 Xunit 测试集成到我们的 TFS 构建中。
我已将 xunit.runner.msbuild.dll 和 xunit.runner.utility.dll 放在文件夹“C:\Program Files\MSBuild\Xunit”中。我在构建文件中有一个任务可以调用 Xunit 任务:
<UsingTask AssemblyFile="$(MSBuildExtensionsPath)\Xunit\xunit.runner.msbuild.dll" TaskName="Xunit.Runner.MSBuild.xunit"/>
.....
<xunit Assembly="$(DropLocation)\$(BuildNumber)\Release\MyDll.dll" Html="TestRun.htm" />
我收到一个错误,我不知道如何调试。我尝试让“每个人”用户完全控制 Xunit 文件夹。
D:\bld\141\BuildType\Test.proj(50,3): error : System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
D:\bld\141\BuildType\Test.proj(50,3): error : at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
D:\bld\141\BuildType\Test.proj(50,3): error : at System.Security.CodeAccessPermission.Demand()
D:\bld\141\BuildType\Test.proj(50,3): error : at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
D:\bld\141\BuildType\Test.proj(50,3): error : at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
D:\bld\141\BuildType\Test.proj(50,3): error : at Xunit.Sdk.Executor..ctor(String assemblyFilename)
D:\bld\141\BuildType\Test.proj(50,3): error : at Xunit.ExecutorWrapper.RethrowWithNoStackTraceLoss(Exception ex)
D:\bld\141\BuildType\Test.proj(50,3): error : at Xunit.ExecutorWrapper.CreateObject(String typeName, Object[] args)
D:\bld\141\BuildType\Test.proj(50,3): error : at Xunit.ExecutorWrapper..ctor(String assemblyFilename, String configFilename, Boolean shadowCopy)
D:\bld\141\BuildType\Test.proj(50,3): error : at Xunit.Runner.MSBuild.xunit.ExecuteAssembly(String assemblyFilename, String configFilename, IRunnerLogger logger)