i'm trying make item group of dll's , exe's filtering out msi's , test.dll's.
the following snippet doesn't include .exe in uniqueassemblies itemgroup. contain dll's , removes msi expected though. uniquecompiledfiles contain expected output files (.test.dll, .dll, .msi, .exe)
<target name="customcompile"> <msbuild buildinparallel="true" projects="@(projectfiles)" properties="$(projectproperties)" > <output taskparameter="targetoutputs" itemname="compiledfiles" /> </msbuild> <removeduplicates inputs="@(compiledfiles)"> <output taskparameter="filtered" itemname="uniquecompiledfiles" /> </removeduplicates> <itemgroup> <uniqueassemblies include="%(uniquecompiledfiles.identity)" condition=" '@(uniquecompiledfiles->endswith('.dll'))' == 'true' " /> <uniqueassemblies include="%(uniquecompiledfiles.identity)" condition=" '@(uniquecompiledfiles->endswith('.exe'))' == 'true' " /> </itemgroup> i figured out workaround filter .exe.
<itemgroup> <uniqueassemblies2 include="%(uniquecompiledfiles.identity)" condition=" $([system.string]::new('%(uniquecompiledfiles.identity)').endswith('.exe')) " /> </itemgroup> found out culprit lines removed fix problem doesn't answer question.
<itemgroup> <!-- workaround msbuild defect: https://github.com/microsoft/msbuild/issues/69 --> <uniquecompiledfiles include="project\bin\release\project.exe"> <msbuildsourceprojectfile>project\project.csproj</msbuildsourceprojectfile> <platform>x86</platform> </uniquecompiledfiles> </itemgroup> why @(uniquecompiledfiles->endswith('.exe')) syntax not working expected?
you're trying use property function on item (instead of property).
you should able desired result using this:
<itemgroup> <uniqueassemblies2 include="%(uniquecompiledfiles.identity)" condition=" '%(extension)' == '.exe' " /> </itemgroup>
Comments
Post a Comment