Specflow-从批处理文件运行时,Specrun RazorEngine错误生成报告

当尝试从批处理文件运行Specflow测试时,SpecFlow.Plus.Runner的ReportGenerationLog中出现错误。使用Visual Studio 2019测试资源管理器运行测试时,报告将按预期生成。

这只是在.netCore 2.2中重新创建Selenium测试框架之后才开始发生的。这些报告可以通过.net Framework 4.5的批处理文件正常运行。

错误如下...

2019-11-18T12:33:52.8129867+00:00;Thread#1;Error;RazorEngine.Templating.TemplateCompilationException: Errors while compiling a Template.
Please try the following to solve the situation:
  * If the problem is about missing/invalid references or multiple defines either try to load 
    the missing references manually (in the compiling appdomain!) or
    Specify your references manually by providing your own IReferenceResolver implementation.
    See https://antaris.github.io/RazorEngine/ReferenceResolver.html for details.
    Currently all references have to be available as files!
  * If you get 'class' does not contain a definition for 'member': 
        try another modelType (for example 'null' to make the model dynamic).
        NOTE: You CANNOT use typeof(dynamic) to make the model dynamic!
    Or try to use static instead of anonymous/dynamic types.
More details about the error:
 - error: (292,13) The type 'TechTalk.SpecRun.Framework.Results.TestNodeResultTypeGroup' is defined in an assembly that is not referenced. You must add a reference to assembly 'TechTalk.SpecRun.Common,Version=3.0.0.0,Culture=neutral,PublicKeyToken=d0fc5cc18b3b389b'.
     - error: (292,50) The name 'TestNodeResultTypeGroup' does not exist in the current context
     - warning: (0,0) Assuming assembly reference 'Newtonsoft.Json,Version=9.0.0.0,PublicKeyToken=30ad4fe6b2a6aeed' matches 'Newtonsoft.Json,Version=11.0.0.0,PublicKeyToken=30ad4fe6b2a6aeed',you may need to supply runtime policy
     - warning: (0,you may need to supply runtime policy
     - error: (402,63) The name 'TestNodeResultTypeGroup' does not exist in the current context
     - error: (403,60) The name 'TestNodeResultTypeGroup' does not exist in the current context
     - error: (404,61) The name 'TestNodeResultTypeGroup' does not exist in the current context
     - error: (663,94) The name 'TestNodeResultTypeGroup' does not exist in the current context
     - error: (1485,85) The name 'TestNodeResultTypeGroup' does not exist in the current context

有什么想法可以手动将对TechTalk.SpecRun.Common的引用或如何解决此问题?

以下是我已安装的相关Nuget软件包的版本

    <PackageReference Include="SpecFlow" Version="3.0.225" />
    <PackageReference Include="SpecFlow.Tools.MsBuild.Generation" Version="3.0.225" />
    <PackageReference Include="SpecRun.Runner" Version="3.0.391" />
    <PackageReference Include="SpecRun.SpecFlow" Version="3.0.391" />
    <PackageReference Include="SpecRun.SpecFlow.3-0-0" Version="3.0.391" />
anxinsimu 回答:Specflow-从批处理文件运行时,Specrun RazorEngine错误生成报告

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3080940.html

大家都在问