Creating step definition report i SpecFlow on .NET 4.0

I manage to bring SpecFlow to the project and everyone was really impressed. However, I wasn’t 100 % satisfied with SpecFlow since I wasn’t able to get the step definition report at first. I found the problem to be that my test project was written in .NET 4.0, and needs to be so, but the tools was compiled in .NET 3.5. This caused some reflection problems when the specflow stepdefinitionreport MyProject.csproj was executed and the report wasn’t generated. It worked fine with the execution report. I downloaded the SpecFlow code from github and compiled it using .NET 4.0 instead of .NET 3.5 and got it working, but that is not a good solution since I want to use NuGet to manage my updates of SpecFlow. So after searching around and asking my way on twitter I got an answer by @gasparnagy that pointed me to this Google groups thread where I found a better solution. So the solution I ended up with was to force specflow.exe to use the .NET 4.0 runtime by using the config file below:

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <startup> 
         <supportedRuntime version="v4.0.30319" /> 
    </startup> 
</configuration> 

Just copy the config above and create a specflow.exe.config file and put it next to your specflow.exe and you will be able to create the step definition report.

Comments are closed.