How can I get a .mltbx package to display a license dialog?
    8 views (last 30 days)
  
       Show older comments
    
I have been trying to create a toolbox install file (.mltbx) using the "Package Toolbox" app.  I would like to implement what I've seen some packages on File Central do:  Display a license page, and wait for the user to accept it before proceeding with the install.  I tried to place files with names "license.txt", "license.html", "license.xml" and "license" in the root folder to no avail.  Root folder structure is like this:
root
    myToolbox
        file1.m
        file2.m
    myToolboxDocs
        html
            file1.html
            file2.html
            index.html
        helptoc.xml
    info.xml
    license.txt
    license.html
    license.xml
    license.
The generated .mltbx file installs fine, but does not display a license dialog.  Dissecting a downloaded package  that is able to display a license dialog (I have unzipped it) I can see that the "metadata" folder has a file named "license.xml" that my generated .mltbx file does not have.  I must be missing something here, but I cannot figure out what.  Any ideas?
0 Comments
Answers (1)
  Malay Agarwal
      
 on 20 Jan 2025
        
      Edited: Malay Agarwal
      
 on 20 Jan 2025
  
      According to the documentation for creating and sharing toolboxes, you need to provide a valid URL to the license file for the license agreement dialog to show up for your users: https://www.mathworks.com/help/releases/R2023a/matlab/matlab_prog/create-and-share-custom-matlab-toolboxes.html#:~:text=install%20a%20toolbox.-,License%20URL,-%E2%80%94%20The%20URL%20of.
To do this, please modify the "Install Actions" section in the Package a Toolbox dialog box that appears after you select a toolbox folder.
Hope this helps!
3 Comments
  Malay Agarwal
      
 on 21 Jan 2025
				After looking at your requirements a bit more closely, I think MATLAB currently does not provide a way to add a license for custom toolboxes. The reason why the "GUI Layout Toolbox" shows a license is because it is a toolbox made by MathWorks. However, if you'd like to protect the code used by your toolbox, you can look into obfuscating the code. The following resource provides more details on this: https://www.mathworks.com/help/releases/R2023a/matlab/matlab_prog/protect-your-source-code.html
See Also
Categories
				Find more on Introduction to Installation and Licensing in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
