该项目组ItemsFromAnotherTarget
包含:
..\..\References\AnotherFolder\ReferencedAssembly.dll
bin\GeneratedAssembly1.dll
bin\GeneratedAssembly2.dll
somefolder\somefile.txt
somefolder\somefile.exe
bin\anexe.exe
这个想法是生成另一个项目组BinaryFiles
含有
bin\GeneratedAssembly1.dll
bin\GeneratedAssembly2.dll
somefolder\somefile.exe
bin\anexe.exe
所以我有以下内容:
<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
文件夹。知道如何使用通配符进行过滤吗?
我能排除的唯一方法References
文件夹是由正则表达式。这看起来有点老套,欢迎任何其他建议。
<ItemGroup>
<BinaryFiles Include="@(ItemsFromAnotherTarget)" Condition="(!$([System.Text.RegularExpressions.Regex]::IsMatch('%(Identity)', `.\\References\\.`))) and ('%(Extension)'=='.dll' or '%(Extension)'=='.exe')" />
</ItemGroup>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)