What is wrong with this Postbuild event command?

33 Views Asked by At

This PostBuildevent in Visual Studio works:

<Target Name="PostBuild" AfterTargets="PostBuildEvent"
        Condition="$(TargetFramework)=='net7.0'">
    <Exec Command="xcopy /y /d  &quot;$(ProjectDir)BM3DotNet64\*.dll&quot; &quot;$(TargetDir)&quot;" />
</Target>

This however does not work:

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
    <Exec Command="if $(TargetFramework)=='net7.0' ( xcopy /y /d  &quot;$(ProjectDir)BM3DotNet64\*.dll&quot; &quot;$(TargetDir)&quot;)" />
</Target>

The point is that I want the code to xcopy all dll's from a different directory ($(ProjectDir)BM3DotNet64) when the TargetFramework==net471) so I want to add a else statement as well. Adding a second <Target element with a different condition also does not work: only the second one is executed.

Where am I going wrong?

0

There are 0 best solutions below