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