fsprojects / FSharp.Formatting

F# tools for generating documentation (Markdown processor and F# code formatter)
https://fsprojects.github.io/FSharp.Formatting/
Other
464 stars 156 forks source link

'fsdocs build' doesn't find TargetPath for projects using `TargetFrameworks` multi-targeting #551

Open dsyme opened 4 years ago

dsyme commented 4 years ago

@Krzysztof-Cieslak This is a bug related to the tool's use of dotnet-proj-info - you might know the answer or where to look?

Basically of a project file uses

 <TargetFrameworks>...</TargetFrameworks>

then the project cracking logic used by fsdocs build doesn't find TargetPath for the default target framework.

You currently have to switch to a single TargetFramework

 <TargetFramework>...</TargetFramework>

(We get an error like this if anyone is searching for this)

Error :
System.ArgumentNullException: Value cannot be null. (Parameter 'path')
   at System.IO.Path.GetFullPath(String path)
   at <StartupCode$FSharp-Formatting-ApiDocs>.$GenerateModel.libDirs@1573.Invoke(String arg00) in E:\GitHub\dsyme\FSharp.Formatting\src\FSharp.Formatting.ApiDocs\GenerateModel.fs:line 1573
   at Microsoft.FSharp.Primitives.Basics.List.map[T,TResult](FSharpFunc`2 mapping, FSharpList`1 x) in E:\A\_work\130\s\src\fsharp\FSharp.Core\local.fs:line 250
   at Microsoft.FSharp.Collections.ListModule.Map[T,TResult](FSharpFunc`2 mapping, FSharpList`1 list) in E:\A\_work\130\s\src\fsharp\FSharp.Core\list.fs:line 76
   at FSharp.Formatting.ApiDocs.ApiDocsModel.Generate(IEnumerable`1 dllFiles, FSharpOption`1 parameters, FSharpOption`1 xmlFile, FSharpOption`1 sourceRepo, FSharpOption`1 sourceFolder, FSharpOption`1 publicOnly, FSharpOption`1 libDirs, FSharpOption`1 otherFlags, FSharpOption`1 mdcomments, FSharpOption`1 urlRangeHighlight, String rootUrl) in E:\GitHub\dsyme\FSharp.Formatting\src\FSharp.Formatting.ApiDocs\GenerateModel.fs:line 1573

In theory I guess we could also build API docs for each of the targets but I don't think it will be needed much, the default will do.

kurtschelfthout commented 3 years ago

Same issue, nicer error with latest version:

> dotnet fsdocs build --projects .\src\FsCheck\FsCheck.fsproj
cracking projects...
  skipping project 'FsCheck.fsproj' because it doesn't have a target path
Error while cracking project files, no project files succeeded, exiting.

Removing TargetFrameworks solves it.