Problem embedding image in the help file

Topics: Developer Forum
Jun 7, 2012 at 11:43 PM

Hi,

  I am a novice SHFB user and am having problems making an image to show/render within the help file generated by SHFB/Sandcastle. The SHFB FAQ explains that the image needs to be placed at the root of the directory where the help file is generated (/Help). I have placed one copy there, one in the same directory where the help file is and tried a lots of other places too. The file is included in the project as an existing image file item (right click in project explorer->Add Existing Item-> choose file type Image and point to the file in the root folder of the help file directory. I set the BuildAction to Content.

  My HTML code (within the XML file generated by Visual Studio) that refers to the image is:

<img src="../ImageFileName.gif"/>

(but I have tried a host of other alternatives in terms of specifying the path).

The sad thing is that i had this working once and was so excited that I went and started playing with some other combinations that I lost the setup that worked and now I cannot figure out how I made it work.

  Please help. Thank you,

Milorad

Coordinator
Jun 8, 2012 at 7:28 PM

It sounds like you did it right.  Add the image file to the root of the SHFB project and set it's build action to Content.  When built, the image file will be copied to the root folder of the help file content.  Using the relative path as you've got it in the XML comments should work.  If in doubt, build a website version of the project and see were the image ends up.

Eric

 

Jun 9, 2012 at 4:22 AM
EWoodruff wrote:

Eric,

  Thanks for the reply. Can you please provide a link to read more about how to build the web site version of the project.

Milorad

 

It sounds like you did it right.  Add the image file to the root of the SHFB project and set it's build action to Content.  When built, the image file will be copied to the root folder of the help file content.  Using the relative path as you've got it in the XML comments should work.  If in doubt, build a website version of the project and see were the image ends up.

Eric

 

 

Coordinator
Jun 9, 2012 at 6:22 PM

Set the HelpFileFormat property to Website and build, that's all there is to it.  See the property topics in the help file for more information on what they do.

Eric

 

Jun 11, 2012 at 10:44 PM

Eric,

  Thanks a lot for your prompt answers. I actually managed to make it work again but did not do anything different from what i described above (the image file is still in the root directory). What did happen in the meantime is that I left the SHFB project session and when I opened it again after the weekend the image file was not included as a resource in the project explorer window pane on the right hand side. I went and included it again (pointing to the image file in the root of the /Help directory) and chose "Content" for BuildAction. After the build the image was included again.

  I know that my problems started when, after reaching the stage where i achieved the above, I tried to move the image file into the Images sub-directory of the project root. I will probably try to do that again at some point but not right now.

  BTW, I have another question related to the web version of the help file that you explained how to generate above. I found that one can view HTML or ASP.NET version of this but that ASP.NET one is far superior in how it is displayed (the HTML one looked real strange with a lot of misplaced elements and panes dimensioned real awkwardly). My question is how can I share the link to the ASP.NET version with the others? When I initiated the viewing from SHFB it gave me the link that looked something like this:

http://localhost:12345/SHFBOutput_131838/Index.aspx

  My ASP.NET knowledge is extremely limited but I would like to know if I can somehow replace localhost part with the server network name and get to the same pages? I tried it and it did not work. Is that the right way to do it? Also, is it possible to use the SHFB project name I specified in HelpTitle or HtmlHelpName instead of the "SHFBOutput_131838" directory used above?

  Thanks again,

Milorad

Coordinator
Jun 12, 2012 at 7:40 PM

The HTML version of the website may be blocked on the local file system so you have to respond to the IE prompt to allow scripts to run.  The only way to get the ASP.NET version to run is to upload it to a web server or use the test server (WebDev.WebServer40.exe) supplied with .NET to run it locally.  If ran locally, everyone would need to start the test web server locally and point it at the folder containing the files which is what SHFB does.  If you don't have an actual web server, compiling to Help 1 is probably the easiest approach.

Eric

 

Jun 13, 2012 at 2:17 PM

Thanks a lot Eric. The script switch worked nicely ...