Error MSB4067: <When> element below <Choose> element is not recognized

I have the following code:

<Import Project="C:\Program%20Files%20(x86)\MSBuild\ExtensionPack\4.0.13.0\x64\MSBuild.ExtensionPack.tasks" /> <PropertyGroup> <Workspace></Workspace> <SolutionName></SolutionName> <TargetEnv></TargetEnv> <DeployPath></DeployPath> <TargetBranch></TargetBranch> <BuildNumber></BuildNumber> <Revision></Revision> </PropertyGroup> <Target Name="assinfo"> <Choose> <When Condition=" '$(TargetEnv)'=='development' "> <PropertyGroup> <Revision>1</Revision> </PropertyGroup> </When> </Choose> 

Msbuild shows this error:

C: \ workspace \ BuildScripts \ buildTEST.proj (20.3): error MSB4067: the When element under the Select element is not recognized.

I need to understand what happened.

+8
source share
1 answer

It looks like you tried to use <Choose> inside the <Target> element. This is not currently supported by MSBuild.

+16
source

Source: https://habr.com/ru/post/1270015/


All Articles