Answer the question
In order to leave comments, you need to log in
How to substitute different commands in PostBuildEvents depending on the configuration of the solution?
How can I make PostBuildEvents to substitute the Windows command for the Debug configuration, and substitute the Linux command for the Linux configuration?
I just need to copy the output file to a shared directory for all projects in the solution.
On Windows I copy like this: xcopy "$(TargetPath)" "$(SolutionDir)bin\$(ConfigurationName)\$(SolutionName)\" /Y
I tried in the project file (*.csproj) to replace this:
<PropertyGroup>
<PostBuildEvent>xcopy "$(TargetPath)" "$(SolutionDir)bin\$(ConfigurationName)\$(SolutionName)\" /Y</PostBuildEvent>
</PropertyGroup>
<Choose>
<When Condition="'$(Configuration)'!='Linux'">
<PropertyGroup>
<PostBuildEvent>xcopy "$(TargetPath)" "$(SolutionDir)bin\$(ConfigurationName)\$(SolutionName)\" /Y</PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<PostBuildEvent></PostBuildEvent>
</PropertyGroup>
</Otherwise>
</Choose>
Answer the question
In order to leave comments, you need to log in
so, you Configuration
just do not equal Linux
, but equal (judging by what is used in the path itself), Release
add another variable to control the build platform. For example, Platform
then it will<When Condition="'$(Platform)'!='Linux'">
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question