在与功能文件不同的位置生成 SpecFlow 的 feature.cs 文件 [英] Generating SpecFlow's feature.cs files in a different location to the feature files

查看:14
本文介绍了在与功能文件不同的位置生成 SpecFlow 的 feature.cs 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

相当简单的一个:我试图让 SpecFlow 生成 feature.cs 文件,但在我指定的目录中,而不是默认目录(与关联的功能文件相同的目录).这可能吗?

Fairly simple one: I'm trying to make SpecFlow generate feature.cs files, but in a directory I specify and not the default (which is the same directory as the associated feature file). Is this possible?

推荐答案

默认情况下不是,但有可能.

Not by default, but it might be possible.

SpecFlow 在 Visual Studio 中使用一种称为自定义工具的内置机制.它是一种在文件更改时自动执行操作的方法,也用于设计器(例如 winforms、asp.net 等),这些设计器也会生成 xxx.designer.cs 文件.有关详细信息,请参阅 https://msdn.microsoft.com/en-us/library/hefydhhy.aspx

SpecFlow uses an inbuilt mechanism inside Visual Studio called a custom tool. its a means of automatically performing an action whenever a file changes and is also used in designers (such as the winforms, asp.net etc) which also generate an xxx.designer.cs file. For more details see https://msdn.microsoft.com/en-us/library/hefydhhy.aspx

这由 .csproj 文件中的几个条目控制

This is controlled by a couple of entries in the .csproj file

<None Include="xxx.feature">
   <Generator>SpecFlowSingleFileGenerator</Generator>
   <LastGenOutput>xxx.feature.cs</LastGenOutput>
</None>

<Compile Include="xxx.feature.cs">
  <DependentUpon>xxx.feature</DependentUpon>
  <AutoGen>True</AutoGen>
  <DesignTime>True</DesignTime>
</Compile>

如您所见,您在此处拥有更改文件位置并保持它们之间的关联所需的所有信息.不过我从未尝试过,所以请告诉我们您的进展情况.

So as you can see you have all the information you need here to change the file locations and keep the association between them. However I've never tried it, so let us know how you get on.

这篇关于在与功能文件不同的位置生成 SpecFlow 的 feature.cs 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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