red-gate / XmlDoc2CmdletDoc

Create cmdlet XML help files from XML doc comments
Other
63 stars 24 forks source link

Dotnetcore - Add support for .NET 5.0 #61

Open trondr opened 2 years ago

trondr commented 2 years ago

After adding support for .net 5.0 it is now possible to create maml from .net 5.0 F# binary code with the added manual step of putting the FSharp.Core.dll in the same directory as XmlDoc2CmdletDoc.exe.

Post-build script on the cmdlet library project:

"$(ProjectDir)..\..\tools\XmlDoc2CmdletDoc\XmlDoc2CmdletDoc.exe" -strict "$(TargetPath)"

F# cmdlet code example:

namespace OsmPowerCli.Library.CmdLets

open System.Management.Automation
open OsmPowerCli.Library.OsmData

/// <summary>
/// <para type="synopsis"></para>
/// <para type="description">Get OSM map</para>
/// <example>
///     <code>Get-OsmMap -MinLongitude 10.1554 -MinLattitude 59.7368 -MaxLongitude 10.2276 -MaxLattitude 59.7448</code>
/// </example>
/// </summary>
[<Cmdlet(VerbsCommon.Get,"OsmMap")>]
[<OutputType(typeof<string>)>]
type GetOsmMapCommand () =
    inherit PSCmdlet ()

    /// <summary>
    /// <para type="description">Minimum longitude of the map.</para>
    /// </summary>
    [<Parameter(Mandatory=true)>]
    member val MinLongitude :float = 0.0 with get,set

    /// <summary>
    /// <para type="description">Minimum lattitude of the map.</para>
    /// </summary>
    [<Parameter(Mandatory=true)>]
    member val MinLattitude :float = 0.0 with get,set

    /// <summary>
    /// <para type="description">Maximum longitude of the map.</para>
    /// </summary>
    [<Parameter(Mandatory=true)>]
    member val MaxLongitude :float = 0.0 with get,set

    /// <summary>
    /// <para type="description">Maximum lattitude of the map.</para>
    /// </summary>
    [<Parameter(Mandatory=true)>]
    member val MaxLattitude :float = 0.0 with get,set

    override this.ProcessRecord() =
        let bounds = {
            MinLongitude = this.MinLongitude
            MinLattidue = this.MinLattitude
            MaxLongitude = this.MaxLongitude
            MaxLattitude = this.MaxLattitude
        }
        let osmMap = OsmPowerCli.Library.OsmData.getOsmMap bounds
        this.WriteObject(osmMap)
        ()