Search code examples
paket

What is the format to add a comment in a paket's file?


My current pake.dependencies look like this:

source https://api.nuget.org/v3/index.json
storage: none
framework: netstandard2.0
strategy: min
lowest_matching: true

nuget FSharp.Core >= 5.0.0
nuget TypeShape >= 10.0.0

group test
source https://api.nuget.org/v3/index.json
storage: none
framework: net6.0

nuget FsCheck
nuget FsCheck.Xunit
nuget Microsoft.NET.Test.Sdk
nuget xunit
nuget xunit.runner.visualstudio

I would like to comment one or more lines.

storage: none
/* See the reason why `netstandard2.0` at shorturl.at/oKMU3 */
framework: netstandard2.0
strategy: min
lowest_matching: true

The code can be seen on GitHub

How can I do that?


Solution

  • You can use either // or # to comment in a paket file:

    storage: none
    # See the reason why `netstandard2.0` at shorturl.at/oKMU3
    framework: netstandard2.0
    strategy: min
    lowest_matching: true
    

    Here is an example from the official documentation:

    source https://api.nuget.org/v3/index.json
    
    // NuGet packages
    nuget NUnit ~> 2.6.3
    nuget FAKE ~> 3.4
    nuget DotNetZip >= 1.9
    

    From the source code, here is a test and the parser (which uses the regex ^\s*(#|(\/\/)))