MSBuild says the "Label" attribute is unrecognized only when I import a specific targets file

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 am getting this build error:

"Label" attribute in <Import> element is not recognized

I can remove the Label attribute from the first Import element, or remove the second import element entirely to get rid of the error.

Can someone please explain what's going on? It looks like the content of the second target file changes the version used by MSBuild ... somehow.

Note. You can get these targets by adding the SlowCheetah and Specflow NuGet packages to your project.

+3


source to share


1 answer


While it manifests itself as a MsBuild error, it is indeed a SpecFlow issue (check the complete error, the line number points to TechTalk.SpecFlow.targets where it calls the GenerateAll task, which is imported from specflow.exe into the TechTalk.SpecFlow tasks): SpecFlow Package DLL NuGets are built on .Net35, which doesn't support the attribute Label

on PropertyGroup

. So when you pass it a project file like yours that happens to contain a label like this, the filter fails somewhere.



SpecFlow claims to work with .Net40, so you can probably build the .Net40 NuGet package from source yourself and then use that instead of the online version. Or raise your support ticket with SpecFlow: .Net35 is pretty old already.

+2


source







All Articles