pre build event with if condition

256 views Asked by At

I'm looking to do this:

if "$(TargetDir.Contains('BeamCutSoft_E'))" == true
    xcopy /E /Y "$(ProjectDir)LibsEssential" "$(TargetDir)"
else
    xcopy /E /Y "$(ProjectDir)LibsPremium" "$(TargetDir)"

but I get the error :

The command "if "False" == true xcopy /E /Y "C:\DEV\Repos_BeamcutSoft\Simulateur\C#\Beamcut\LibsEssential" "C:\Beamcut Apps\BeamCutSoft_P422_NewUI DEV" else xcopy /E /Y "C:\DEV\Repos_BeamcutSoft\Simulateur\C#\Beamcut\LibsPremium" "C:\Beamcut Apps\BeamCutSoft_P422_NewUI DEV"" exited with code 255.

1

There are 1 answers

0
Astro On BEST ANSWER

I found a diffente way to achive what I want:

in my csproj

i put this:

<ItemGroup Condition="$(TargetDir.Contains('BeamCutSoft_E'))">
    <Reference Include="Caliburn.Micro, Version=1.5.2.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>.\LibsEssential\Caliburn.Micro.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup Condition="$(TargetDir.Contains('BeamCutSoft_P'))">
    <Reference Include="Caliburn.Micro, Version=1.5.2.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>.\LibsPremium\Caliburn.Micro.dll</HintPath>
    </Reference>
  </ItemGroup>