Search Results for

    Show / Hide Table of Contents

    Automating the Build Process

    Learn how you can build libraries including SmartComponents from the command line and how to build more than one library at the same time.

    This can be useful when you want to

    • automatically rebuild your libraries when for example their geometry-files have been updated.
    • add a custom build step step like signing an assembly before building a SmartComponent with Code Behind.
    • build without the need for a Visual Studio project.
    • build a SmartComponent with Code Behind and the assembly has alraedy been built at an earlier stage.
    • make a Post-build step in a Visual Studio project more managable by factoring out logic to a separate batch file.
    Tip

    In this section you will learn how the Post-build steps of a SmartComponent template project works. It contains the same steps.

    Automating the build using a batch file

    1. Create a new SmartComponent project using the template in Visual Studio. Lets give it the default name "SmartComponent1".

    2. With any text editor, create a batch file named build.bat in the same directory as the SmartComponent. This batch file will contain the commands needed to build it.

    3. The Library Compiler needs to be invoked from our batch script to process our XML file and yield a SmartComponent. To do so, add the following commands to the batch file:

      "%ProgramFiles(X86)%\ABB\RobotStudio <version>\bin\LibraryCompiler.exe" "$(ProjectDir)\SmartComponent1.xml"
      
      Important

      Remember to replace the <version> part of the path to the LibraryCompiler.exe with the version number of your RobotStudio installation.

    4. Execute the batch file form the command line or as an external command called from another part of your development tool-chain.

    Building more than one SmartComponent from a single XML file

    • Using the Include element in your library xml file you can include other library files. Create a new XML file in the project directory with the name BuildAll.xml and the following content:

      <?xml version="1.0" encoding="utf-8"?>
      <LibraryCompiler xmlns="urn:abb-robotics-robotstudio-librarycompiler">
        <!-- From one library XML file you can include other library XML files.
             They will be pased to the LibraryCompiler.exe.-->
        <Include source="SmartComponent1.xml"/>
        <Include source="SmartComponent1 - Copy.xml"/>
      </LibraryCompiler>
      
    • Make a copy of the file SmartComponent1.xml named SmartComponent1 - Copy.xml

    • Modify your build.bat to look like this:

      "%ProgramFiles(X86)%\ABB\RobotStudio <version>\bin\LibraryCompiler.exe" "$(ProjectDir)\BuildAll.xml"
      
      Important

      Remember to replace the <version> part of the path to the LibraryCompiler.exe with the version number of your RobotStudio installation.

      Tip

      The SmartComponents walk-through contains both command line build and usage of batch Include element.

    Example

    Invoking the LibraryCompliler.exe from a batch file (build.bat).

    "%ProgramFiles(X86)%\ABB\RobotStudio <version>\bin\LibraryCompiler.exe" SmartComponent1.xml
    

    In one library file (BuildAll.xml), include two other library files.

    <?xml version="1.0" encoding="utf-8"?>
    <LibraryCompiler xmlns="urn:abb-robotics-robotstudio-librarycompiler">
      <!-- From one library XML file you can include other library XML files.
           They will be pased to the LibraryCompiler.exe.-->
      <Include source="SmartComponent1/SmartComponent1.xml"/>
      <Include source="SmartComponent2/SmartComponent2.xml"/>
    </LibraryCompiler>
    

    Compiling the code

    Open a command prompt and set the current directory to the directory of the XML file. Invoke build.bat. You shall see an output similar to:

    ABB Robotics LibraryCompiler 20.1.9000.0
    Command line: "C:\Program Files (x86)\ABB\\RobotStudio 2020\bin\LibraryCompiler.exe"  SmartComponent1.xml
    Compiling C:\Users\JohnDoe\Projects\SmartComponent1\SmartComponent1\SmartComponent1.xml
    Added 'en' resources to SmartComponent1
    Created C:\Users\JohnDoe\Projects\SmartComponent1.rslib
    

    See Also

    • Library Compiler
    • Building a SmartComponent
    In This Article
    Back to top Copyright © 2024 ABB