Reputation: 7345
When I use the following imports together:
<Import Project="$(SlowCheetahTargets)" Condition="Exists('$(SlowCheetahTargets)')" Label="SlowCheetah" />
<Import Project="$(SolutionDir)\packages\SpecFlow.1.9.0\tools\TechTalk.SpecFlow.targets" Condition="Exists('$(SolutionDir)\packages\SpecFlow.1.9.0')" />
I get this build error:
The attribute "Label" in element <Import> is unrecognized
I can remove the Label attribute from the first Import element or completely remove the second import element to get rid of the error.
Can someone explain what is going on? It seems like the contents of the second targets file is changing the version of MSBuild being used...somehow.
Note: You can get these targets by adding SlowCheetah and Specflow NuGet packages to your project.
Upvotes: 3
Views: 1761
Reputation: 35921
Although manifested as an MsBuild error this is really a problem with SpecFlow (check the full error, the line number points to TechTalk.SpecFlow.targets where it invokes the GenerateAll task which is imported from specflow.exe in TechTalk.SpecFlow.tasks): SpecFlow's NuGet package's dlls are built against .Net35 which does not support the Label
attribute on PropertyGroup
. So when you pass it a project file, like yours, which happens to contain such Label somewhere specflow fails.
SpecFlow claims to work with .Net40 so you can probably build the NuGet package against .Net40 from source yourself, then use it instead of the online version. Or raise a support ticket with SpecFlow: after all .Net35 is already quite old.
Upvotes: 2