Platform specific project files VS - PostBuildEvent

Good evening,

I would like to setup a platform specific Visual Studio project file. Right now I am running into a problem on how the PostBuildEvent would look like on Mac. This is what I have for Windows:

Grasshopper:

<PropertyGroup Condition="$(DefineConstants.Contains('ISWIN'))">
  <PostBuildEvent>Copy "$(TargetPath)" "$(TargetDir)$(ProjectName).gha"</PostBuildEvent>
</PropertyGroup>

Rhino:

<PropertyGroup Condition="$(DefineConstants.Contains('ISWIN'))">
  <PostBuildEvent>Copy "$(TargetPath)" "$(TargetDir)$(ProjectName).rhp"</PostBuildEvent>
</PropertyGroup>

So on Mac how would that look like?

<PropertyGroup Condition="$(DefineConstants.Contains('ISMAC'))">
  <PostBuildEvent>" ... ??? ... "</PostBuildEvent>
</PropertyGroup>

Kindest
Christian

Perhaps instead of using the PostBuildEvent to copy files you could instead use the Copy task? The RhinoCycles project uses this to do cross-platform copying of files.

Additionally it may be worth using the regular approach to checking for OS using the Condition checking against $(OS).

1 Like

Good one. I did it even easier:

<Target Name="AfterBuild">
  <Copy SourceFiles="$(TargetPath)" DestinationFiles="$(TargetDir)\$(ProjectName).rhp" OverwriteReadOnlyFiles="True" />
</Target>

This line works on both platforms.

Thanks
Christian

1 Like