none
How to Add Help file to C# Cmdlet? RRS feed

  • Question

  • I have a functioning cmdlet written in VS2013 C#.  I created the -help.xml file.  I've searched for hours and can't figure out the steps to get the Get-Help cmdlet to use my help file.  I've got it named.  How does PowerShell know to load my help file when the dll is imported?
    Wednesday, July 29, 2015 1:54 AM

Answers

  • Place the module and help in this folder:

    $pshome\modules\SPCommon

    This should be one of these paths:

    $env:PSModulePath -split ';'


    \_(ツ)_/


    • Edited by jrv Wednesday, July 29, 2015 10:27 PM
    • Marked as answer by Scott Harwood Wednesday, July 29, 2015 11:17 PM
    Wednesday, July 29, 2015 10:26 PM

All replies

  • Same folder same name correct extension.

    <PSSnapInAssemblyName>.dll-Help.xml


    \_(ツ)_/

    Wednesday, July 29, 2015 2:08 AM
  • I don't know where you searched, but it's all written in the MSDN Library. Take a look at https://msdn.microsoft.com/en-us/library/dd878343(v=vs.85).aspx.

    wizend

    Wednesday, July 29, 2015 12:55 PM
  • Yes - ideally it would bein a subfolder of the module folder but it can also be directly in the module folder.  If you are planning on MUI support then place it in the subfolder with the culture tag for the culture supported by the help file.

    Warning: If you are planning to support "Update-Help" then you need to be suree that the cuture on the machine matches oor that theuser adds UICulture to the update-help command.


    \_(ツ)_/

    Wednesday, July 29, 2015 1:09 PM
  • Yes.  I used MSDN to create the file and tried placing it in both of the folders mentioned in these posts.  I tried naming the file with upper and lower case 'H' (*.dll-help.xml).  Presuming there is nothing that I need to do in the C# cmdlet code to reference the help doc, I assume that there is a problem with the document contents.  I will try copying a functioning help file from a Microsoft library and go from there.

    Thank you for confirming that I have done some things correctly.


    Scott

    Wednesday, July 29, 2015 5:19 PM
  • I put my helpfiles in a language-specific subdirectory of my module directory, as seen in some PowerShell included modules under $PSHOME\Modules (PSWorkflow for instance) and it worked for me.

    Perhaps, you give that a try, too.

    wizend
    Wednesday, July 29, 2015 5:51 PM
  • Can you post the exact name of your DLL and the name of the XML file.

    Post, also, the full path to the module file.


    \_(ツ)_/

    Wednesday, July 29, 2015 5:57 PM
  • SPCommonLib.dll

    SPCommonLib.dll-Help.xml

    Path to both files:   G:\PowerShell Scripts\Common Functions\

    I also have a copy of the help file in:   G:\PowerShell Scripts\Common Functions\en-US\

    Environment Variable PSModulePath includes G:\PowerShell Scripts\Common Functions\


    Scott

    And I ran this script:

    Import-Module"G:\PowerShell Scripts\Common Functions\SPCommonLib.dll"# -Verbose

    Get-Help Add-SPColumnWithID

    Wednesday, July 29, 2015 10:06 PM
  • Place the module and help in this folder:

    $pshome\modules\SPCommon

    This should be one of these paths:

    $env:PSModulePath -split ';'


    \_(ツ)_/


    • Edited by jrv Wednesday, July 29, 2015 10:27 PM
    • Marked as answer by Scott Harwood Wednesday, July 29, 2015 11:17 PM
    Wednesday, July 29, 2015 10:26 PM
  • Woo hoo!

    That worked.  Thank you!!!


    Scott

    Wednesday, July 29, 2015 11:17 PM
  • Woo hoo!

    That worked.  Thank you!!!


    Scott

    See...all things are actually possible.  YOujeest have to believe. See the following for advanced instruction: https://www.youtube.com/watch?v=XfuBREMXxts


    \_(ツ)_/

    Wednesday, July 29, 2015 11:22 PM
  • Woo hoo!

    That worked.  Thank you!!!


    Scott

    See...all things are actually possible.  YOujeest have to believe. See the following for advanced instruction: https://www.youtube.com/watch?v=XfuBREMXxts


    \_(ツ)_/

    I'm a believer.

    There's not a trace... of doubt in my mind.

    --This does bring up questions about why it wasn't working in the other path.  But, that is not a big deal.


    Scott

    Wednesday, July 29, 2015 11:33 PM