Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSharp library not used for generating API docs #857

Open
kMutagene opened this issue Oct 26, 2023 · 7 comments
Open

CSharp library not used for generating API docs #857

kMutagene opened this issue Oct 26, 2023 · 7 comments

Comments

@kMutagene
Copy link
Contributor

kMutagene commented Oct 26, 2023

At some point the fsdocs tool stopped generating API docs for a C# library (Plotly.NET.CSharp) in a mixed F#/C# solution (https://github.com/plotly/Plotly.NET/tree/dev/src). I am 100% certain that this worked in the past. Now the tool only selects the F# projects for API doc generation:

./> "dotnet.exe"  fsdocs watch --eval --clean --properties Configuration=Release --parameters fsdocs-package-version 5.0.0 (In: false, Out: false, Err: false)
discarding project state in '.fsdocs/cache' as now invalid
cracking projects...
  skipping project 'build.fsproj' because it isn't a library

Inputs for API Docs:
    C:\Users\schne\source\repos\plotly\Plotly.NET\src\Plotly.NET\bin\Release\netstandard2.0\Plotly.NET.dll
    C:\Users\schne\source\repos\plotly\Plotly.NET\src\Plotly.NET.ImageExport\bin\Release\netstandard2.0\Plotly.NET.ImageExport.dll
    C:\Users\schne\source\repos\plotly\Plotly.NET\src\Plotly.NET.Interactive\bin\Release\netstandard2.1\Plotly.NET.Interactive.dll

Substitutions/parameters:
  root --> http://localhost:8901/
  fsdocs-authors --> Timo Mühlhaus, Kevin Schneider, F# open source contributors
  fsdocs-collection-name --> Plotly.NET

...

I have a build step that builds all projects including the C# project before starting docs generation, so the binaries are there.

Could it be a problem that the C# project targets .net6.0 ?

@nojaf
Copy link
Collaborator

nojaf commented Oct 26, 2023

Hi there, does it get picked up when you specify it explicitly via --projects?

The help text says Project files to build API docs for outputs, defaults to all packable projects..
Just checking, but is it packable?

@kMutagene
Copy link
Contributor Author

Just checking, but is it packable?

Does this have to be set explicitly? I do not set anything in that regard on the F# projects. i am publishing all libraries (including the C# library) as nuget packages via dotnet pack so i would expect it to be packable right?

does it get picked up when you specify it explicitly via --projects?

I have not tried it now, but remember it not working when i tried last time. Will try it again later and report back

--projects | Project files to build API docs for outputs, defaults to all packable projects

How are multiple projects expected to be passed here? comma-separated full paths? one directory containing all projects?

@nojaf
Copy link
Collaborator

nojaf commented Oct 26, 2023

How are multiple projects expected to be passed here?

Hmm, I'm not quite sure, you could try:

  • --projects A.fsproj B.csproj
  • --projects A.fsproj --projects B.csproj

I don't think it will be comma-separated, it really will depend on how https://github.com/commandlineparser/commandline does the argument parsing.

full paths?

Yeah, definitely try full paths when relative ones don't work.

one directory containing all projects?

No, it does expect actual projects, not directories.

@kMutagene
Copy link
Contributor Author

kMutagene commented Oct 27, 2023

So this is really weird. If i run this fake build task:

let watchDocs =
    BuildTask.create "WatchDocs" [ build ] {
        printfn "watching docs with stable version %s" stableDocsVersionTag

        runDotNet
            "fsdocs watch --eval --clean --properties Configuration=Release --projects <absolute project paths here>
            "./"
    }

which basically only runs

dotnet fsdocs watch --eval --clean --properties Configuration=Release --projects <absolute project paths here>

i get this error (for ALL, F# and C#) projects:

skipping project 'Plotly.NET.fsproj' because an error occurred while cracking it: System.Exception: project 'C:\Users\epos\plotly\Plotly.NET\src\Plotly.NET\Plotly.NET.fsproj' not restored
   at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThenFail@1448.Invoke(String message)
   at fsdocs.Crack.crackProjectFile[a](a slnDir, FSharpList`1 extraMsbuildProperties, String file) in /home/runner/work/FSharp.Formatting/FSharp.Formatting/src/fsdocs-tool/ProjectCracker.fs:line 346
   at [email protected](String p) in /home/runner/work/FSharp.Formatting/FSharp.Formatting/src/fsdocs-tool/ProjectCracker.fs:line 453
skipping project 'Plotly.NET.CSharp.csproj' because an error occurred while cracking it: System.Exception: project 'C:epos\plotly\Plotly.NET\src\Plotly.NET.CSharp\Plotly.NET.CSharp.csproj' not restored
   at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThenFail@1448.Invoke(String message)
   at fsdocs.Crack.crackProjectFile[a](a slnDir, FSharpList`1 extraMsbuildProperties, String file) in /home/runner/work/FSharp.Formatting/FSharp.Formatting/src/fsdocs-tool/ProjectCracker.fs:line 346
   at [email protected](String p) in /home/runner/work/FSharp.Formatting/FSharp.Formatting/src/fsdocs-tool/ProjectCracker.fs:line 453

if i run the same command from the command line, everything works out.

@nojaf
Copy link
Collaborator

nojaf commented Oct 27, 2023

Euhm, yeah this is some fun stuff. Project cracking fails and who knows what FAKE is doing to influence it.
What OS and dotnet SDK version are you using?

@kMutagene
Copy link
Contributor Author

What OS and dotnet SDK version are you using?

Win 11 Pro Version 10.0.22621 Build 22621
and .NET 6.0.416

But it seems like the workaround of just building with fake and then calling the tool manually with --projects will work for me for now. as you said, diagnosing what fake is actually influencing here might be quite hard (and even a local problem maybe?)

@nojaf
Copy link
Collaborator

nojaf commented Oct 27, 2023

If you were running with the dotnet 8 preview SDK I had some environment variables in mind you could give a try. But as you are sticking to the stable 6 SDK I have no immediate idea what you could try.

I would work around it for now. But we should keep this ticket open and provide a better DX when project cracking fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants