Skip to content

Dev_PostBuildEvents

Mehmet Emre Çakal edited this page Oct 10, 2024 · 1 revision

Post Build Events

Since the com.siemens.ros-sharp Unity package contains the complete ROS# .NET solution, we decided to write a post-build event script for both Windows (powershell) and Linux (bash) to automatically update the Unity package after each successful Visual Studio build. The script basically finds all the .cs files from the .NET solution directory, removes unnecessary Visual Studio related files that Unity doesn't like, and copies them to the Unity package. In this way, the ROS# core can be modified and tested in Unity at the same time without any additional automation overhead. If you are not modifying the core ROS# .NET scripts while testing/working with the Unity package, there is no need to worry.

To enable the scripts, the Visual Studio project's `Post-build event' must be modified as follows:

  • For RosBridgeClient project only. Build order does not matter, but MessageGenerationConsoleTool depends on MessageGeneration, RosBridgeClientTest depends on RosBridgeClient and UrdfTest depends on Urdf.
  • Head to Project > Project Properties > Build > Events > Post-build event
  • Paste the following event:
    cd ..
    cd ..
    if "$(OS)" == "Windows_NT" (
     powershell.exe -ExecutionPolicy Bypass -File .\Libraries\PostBuildEvents\UpdateUPM_Win.ps1
    ) else (
      ./Libraries/PostBuildEvents/UpdateUPM_NonWin.sh
    )

    Important: Script needs to be called from the ros-sharp repo root folder.


© Siemens AG, 2017-2024

Clone this wiki locally