1
工作这的ItemGroup ItemsFromAnotherTarget
包含:MSBUILD的ItemGroup排除不使用通配符
..\..\References\AnotherFolder\ReferencedAssembly.dll
bin\GeneratedAssembly1.dll
bin\GeneratedAssembly2.dll
somefolder\somefile.txt
somefolder\somefile.exe
bin\anexe.exe
的想法是生成包含
bin\GeneratedAssembly1.dll
bin\GeneratedAssembly2.dll
somefolder\somefile.exe
bin\anexe.exe
所以我有另一个项目组BinaryFiles
如下:
<ItemGroup>
<BinaryFiles Include="@(ItemsFromAnotherTarget)" Condition="'%(Extension)'=='.dll' or '%(Extension)'=='.exe'" Exclude="..\..\References\AnotherFolder\ReferencedAssembly.dll" />
</ItemGroup>
因此,这会生成所需的项目组。但如果我们用通配符替代Exclude
,则它不起作用。
Exclude="..\..\**\References\**"
Exclude="..\..\References\**\*.dll"
Exclude="..\..\References\**\*"
None of these work.
的问题是References
文件夹中可能有多个文件夹和dll文件,我们需要将整个文件夹References
。任何想法如何使用通配符进行过滤?
你可以在这里使用了答案:https://stackoverflow.com/questions/35498608/msbuild-how-can-i-exclude-wildcard-paths-matching-a-regex和调整正则表达式,因此包含任何与\ References \左右匹配的东西。否则,您可能必须列出要排除的所有文件,即 ,然后根据该列表过滤BinaryFiles组。 –
stijn
您使用的是哪个版本的msbuild? –
Microsoft(R)Build Engine 15.1.1012.6693版本 – dushyantp