使用MSBuild获取目录中的DLL列表

使用MSBuild获取目录中的DLL列表,msbuild,Msbuild,以下仅提供了1个文件,即exe: <ItemGroup> <AssembliesToMerge Include="$(MSBuildProjectDirectory)\App\bin\Release\*.*" Condition="'%(Extension)'=='.dll'"/> <AssembliesTomerge Include="$(MSbuildProjectDirectory)\App\bin\Release\App.exe"/&

以下仅提供了1个文件,即exe:

<ItemGroup>
      <AssembliesToMerge Include="$(MSBuildProjectDirectory)\App\bin\Release\*.*" Condition="'%(Extension)'=='.dll'"/>
      <AssembliesTomerge Include="$(MSbuildProjectDirectory)\App\bin\Release\App.exe"/>
</ItemGroup>

如果删除Condition属性,AssembliesToMerge将包含目录中的所有文件——DLL或其他文件。我做错了什么


我正在通过ILMerge MSBuildCommunityExtensions任务对此进行测试。如果有一种方法可以直接打印ItemGroup中的项目,那么这可能有助于确保这是Condition属性的问题。

只需在包含中使用通配符即可过滤dll文件()


我认为使用Condition属性不起作用,因为在创建期间尚未设置项元数据,因此
%(扩展名)
为空

<ItemGroup>
  <AssembliesToMerge Include="$(MSBuildProjectDirectory)\App\bin\Release\*.dll"/>
  <AssembliesTomerge Include="$(MSbuildProjectDirectory)\App\bin\Release\App.exe"/>
</ItemGroup>