I am creating an AddIn menu as a help page which will call an HTML page. I have added the recourse folder in my solution. How to specify the path so that any user can assess the HTML file from the help menu. I can assess the HTML when I am debugging it from Visual Studio. But when I am running the ArcGIS Pro separately, I cannot form the path to assess the help HTML. Please help.
How to assess the HTML file from the .esriAddInX.
Using SDK 2.8, VS2019, ArcGIS 2.8.
Solved! Go to Solution.
Do you include your HTML help file in your add-in? If so did you follow these conventions: ProGuide Content and Image Resources · Esri/arcgis-pro-sdk Wiki (github.com)
Otherwise please provide a code snippet with you file path logic.
The HTML file's Build Action must be set to Content, and the Copy to Output Directory setting must be something besides "Do not copy". That will ensure it gets compiled into the add-in, then you can access it from the assembly via https://github.com/Esri/arcgis-pro-sdk/wiki/ProGuide-Content-and-Image-Resources#accessing-document-.... This works both in Visual Studio and when deployed.
Do you include your HTML help file in your add-in? If so did you follow these conventions: ProGuide Content and Image Resources · Esri/arcgis-pro-sdk Wiki (github.com)
Otherwise please provide a code snippet with you file path logic.
Yes, I have added the help folder in the Addin. Below is the code snippet I am trying to create the URL.
protected override void OnClick()
{
ErrorLog erl = new ErrorLog(); // Error handling class
string startupPath = Path.GetFullPath("help/EN/gishelp.htm");
erl.ErrorLogging("File Path for gishelp.html: " + startupPath); // Logging error in some file.
string pathToHtmlFile = FilePathToFileUrl(startupPath);
var charsToRemove = new string[] { "bin/", "Debug/"};
foreach (var c in charsToRemove)
{
pathToHtmlFile = pathToHtmlFile.Replace(c, string.Empty);
}
System.Diagnostics.Process.Start("chrome",pathToHtmlFile);
}
I have included the Help folder in the solution but after build and installation, the folder is not getting included in the Add-in folder. How can I build the solution to include the help folder get added in the Add-in?
The HTML file's Build Action must be set to Content, and the Copy to Output Directory setting must be something besides "Do not copy". That will ensure it gets compiled into the add-in, then you can access it from the assembly via https://github.com/Esri/arcgis-pro-sdk/wiki/ProGuide-Content-and-Image-Resources#accessing-document-.... This works both in Visual Studio and when deployed.
I have added the help folder as below in Visual Studio and made all the containing files as AddInContent.
But Still after building the solution, the help folder doesn't reflect under the Add-in folder. Only the .esriAddInX is visible.
The .esriAddinX is a zip file and gets unzipped when ArcGIS Pro starts. Run ArcGIS pro and double check the folder content after Pro started.
You can look at the 'Chromium Web Browser Control' community sample which implements references to various embedded resources, however, it passes the content to a Chromium web browser control:
I modified and attached that sample to include a local html file - I followed the instructions from my link listed in my previous post. When you run the sample you can duplicate your use case with the add-in like this: