Select to view content in your preferred language

Access static resources like html page in the project.

2014
7
Jump to solution
06-04-2021 07:54 AM
TapasChakrabarty
Emerging Contributor

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.

0 Kudos
2 Solutions

Accepted Solutions
Wolf
by Esri Regular Contributor
Esri Regular Contributor

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.

View solution in original post

StephenRhea_NV5
Frequent Contributor

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.

View solution in original post

7 Replies
Wolf
by Esri Regular Contributor
Esri Regular Contributor

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.

TapasChakrabarty
Emerging Contributor

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);
}

0 Kudos
TapasChakrabarty
Emerging Contributor

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?

0 Kudos
StephenRhea_NV5
Frequent Contributor

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.

TapasChakrabarty
Emerging Contributor

I have added the help folder as below in Visual Studio and made all the containing files as AddInContent.

TapasChakrabarty_0-1622822524048.png

But Still after building the solution, the help folder doesn't reflect under the Add-in folder. Only the .esriAddInX is visible.

TapasChakrabarty_1-1622822749912.png

 

0 Kudos
Wolf
by Esri Regular Contributor
Esri Regular Contributor

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.

Wolf
by Esri Regular Contributor
Esri Regular Contributor

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:

arcgis-pro-sdk-community-samples/Framework/ChromiumWebBrowserSample at master · Esri/arcgis-pro-sdk-...

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:

Wolf_0-1622828750454.png

 

Wolf_1-1622828757597.png