Generating SpecFlow's feature.cs files in a different location to the feature files

主宰稳场 提交于 2019-12-25 04:22:49

问题


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?


回答1:


Not by default, but it might be possible.

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

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>

and

<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.



来源:https://stackoverflow.com/questions/28691852/generating-specflows-feature-cs-files-in-a-different-location-to-the-feature-fi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!