How to get Sharing Details in App Designer
Show older comments
Hello,
is there a method to get the sharing details of the App Designer into my code.
For example I want to display the version and name of the app somewhere in my GUI without programming it directly. So when I create a new version of my app I only have to change the information in the sharing details and it will be updated in my GUI automatically.
Thanks!
8 Comments
1MB1
on 28 Sep 2022
The same in my case...
Allen
on 11 Oct 2022
I too have an interest in a solution to this question. It can be quite cumbersome to have to remember to change the details in multiple locations each time an app is revised/updated versus being able to programmatically extract information from the Sharing Details fields.
Harald Lehmann
on 5 Jan 2023
Hello,
also for me it would be helpful. The actual version number should be visible any time.
Francisco Sacchetti
on 19 Jan 2024
me too
Nico
on 11 Mar 2024
me too
Anna H.
on 24 Jul 2024
I also would like to show the version in the userinterface of my app and access it programatically
Jixiong Su
on 8 Aug 2024
me too
Accepted Answer
More Answers (3)
Taylor
on 23 Jan 2024
0 votes
When you go to package the app there is a field for the version number.

When the app is installed, the user can view the version number by hovering over the app.

4 Comments
Allen
on 23 Jan 2024
@Taylor, unfortunately your answer does not address the question being presented. @Maxi in addition to the a number of other App Creators are looking for a way to programmatically extract the version information entered into Version field when packaging an application. Currently, if a creator wants to provide a version display within their application that any user can readily access, this information must be hard coded into the application.
Speaking for myself and depending on how my application will be used, I may need to package the application into an .exe file and validate that version. Validated versions much be retained for audit purposes and use in accredited testing services that we provide. These validated executables also need to provide a means to display all necessary version information from with the application itself. Executable files do not have the ability to app icon in MATLAB since they run via runtime software and not MATLAB itself. Therefore I like to include a Help>About Application menu item that will display the author, application version, MATLAB version used to create the application, and the date the application was created. If I update my application it becomes cumbersome to the have to remember each and everytime to change all of the the hard coded information.
Forgetting to update the hard code version information happens too often and may not be noticed until well after the application has been released to an end-user. By utilizing the Version field when packaging and using a programmatic extraction approach, App creators would only need to update the version number in that single location, since it is obvious the application and/or executable files store this information when being packaged.
Adee
on 16 Apr 2024
+1 for the exact same reasons. The version and related details of an executable application should be available to display in an "About" dialog - this is a "pattern" followed by practically all applications (including MATLAB's GUI).
Since the "Sharing details" information is not accessible programmatically, I need to store the version information in the code instead. This makes the "Sharing details" section mostly useless.
Taylor
on 16 Apr 2024
@Maxi @Allen @Adee Is this more what you're looking for? https://www.mathworks.com/matlabcentral/answers/2050932-how-to-access-app-version-number-from-inside-the-app
Adee
on 18 Jun 2024
@Taylor, it doesn't seem to work - the code you pointed to takes the version number from the executable file, not from the app designer metadata.
The information in "Sharing details" is not propagated to the execuable file by the Matlab compiler. The version number can be specified using the "-W" switch but it still poses the problem of how to get the right number from the mlapp file...
Also, these details should preferably be available when running the app under MATLAB (before it is deployed).
Brian
on 19 Nov 2024
The below function is what I use to detect the application version and compile date from within an application. This uses the xml2struct function from the File Exchange (https://www.mathworks.com/matlabcentral/fileexchange/28518-xml2struct) to parse the installer file info.
function [ver,date] = CheckAppVersion
% This function examines the installer info to determine the version number
% and release date of an application
if isdeployed
[~, result] = system('path');
p = char(regexpi(result, 'Path=(.*?);', 'tokens', 'once'));
xmlLocation=fullfile(p,'..','uninstall','ApplicationInstallerManifest.xml');
appInfo=xml2struct(xmlLocation);
ver=appInfo.ApplicationInstallerManifest.Version.Text;
file=dir(xmlLocation);
date=datetime(file.date);
date=char(datetime(date,'Format','dd-MMM-yyyy'));
else
fullpath=mfilename('fullpath');
s=settings;
if ~isempty(strfind(fullpath,s.matlab.addons.InstallationFolder.ActiveValue)) % If run from app
[p,~]=fileparts(fullpath); psplit=strsplit(p,filesep);
p=strjoin(psplit(1:find(strcmp(psplit,'Apps'))+1),filesep);
if isfolder(fullfile(p,'resources'))
xmlLocation=fullfile(p,'resources','addons_core.xml');
appInfo=xml2struct(xmlLocation);
ver=appInfo.addonCore.version.Text;
file=dir(xmlLocation);
date=datetime(file.date);
date=char(datetime(date,'Format','dd-MMM-yyyy'));
else
ver='debug';
date='dd-MMM-yyyy';
end
else % If run from MATLAB mlapp file
ver='debug';
date='dd-MMM-yyyy';
end
end
end
Kasey
on 21 Jan 2026
This is the code I insert into startupFcn for deployed stand alone desktop apps. So far I haven't had any issues, even with copying and moving files around.
if isdeployed
% Stand-alone mode (as an .exe)
[status, result] = system('set PATH');
% Extract the path from the PATH environment variable
exePath = regexpi(result, 'Path=(.*?);', 'tokens');
appExe=sprintf("%s.exe",mfilename);
filename=fullfile(string(exePath),appExe);
ver=char( System.Diagnostics.FileVersionInfo.GetVersionInfo( filename ).FileVersion );
verString=sprintf("Version: %s",ver);
app.Label.Text=verString;
end
Categories
Find more on Package and Share Apps 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!