C# MSBuild自定义任务,具有输入参数的变量号
我在中完成了一些自定义任务,但我在这里面临一个新情况 简而言之,我想这样做:C# MSBuild自定义任务,具有输入参数的变量号,c#,msbuild,task,C#,Msbuild,Task,我在中完成了一些自定义任务,但我在这里面临一个新情况 简而言之,我想这样做: <Target Name="MyTarget"> <CustomTask Files=""> <Input Name="SomeName" Action="SomeActionName /> <Input Name="SomeName" Action="SomeActionName /> <Input Name="SomeName"
<Target Name="MyTarget">
<CustomTask Files="">
<Input Name="SomeName" Action="SomeActionName />
<Input Name="SomeName" Action="SomeActionName />
<Input Name="SomeName" Action="SomeActionName />
</CustomTask>
</Target>
其想法是MBSuild可以“检测”子任务,然后将它们的集合交给我,但我只得到了一个MSB4067错误
我已经浏览了很多在线操作系统任务和官方文档,但没有找到任何这样的例子
这样做可能吗?
如果没有,您建议我如何解决此问题(PropertyGroup/ItemGroup/Other)?您试图做的是不可能的。您可以使用项元数据来近似它
<Target Name="MyTarget">
<ItemGroup>
<Input Identity="SomeName"><Action>SomeActionName</Action></Input>
<Input Identity="SomeName"><Action>SomeActionName</Action></Input>
<Input Identity="SomeName"><Action>SomeActionName</Action></Input>
</ItemGroup>
<CustomTask Files="" Input="@(Input)">
</Target>
SomeActionName
SomeActionName
SomeActionName
是的,正如我在帖子中提到的,这绝对是一条我已经准备好考虑的道路。我可能最终会这样做,但我希望有一个更方便读者的方式。如果我找到一个好的选择,我会发回的。
<Target Name="MyTarget">
<ItemGroup>
<Input Identity="SomeName"><Action>SomeActionName</Action></Input>
<Input Identity="SomeName"><Action>SomeActionName</Action></Input>
<Input Identity="SomeName"><Action>SomeActionName</Action></Input>
</ItemGroup>
<CustomTask Files="" Input="@(Input)">
</Target>