FSharp.Formatting icon indicating copy to clipboard operation
FSharp.Formatting copied to clipboard

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

Open dsyme opened this issue 4 years ago • 1 comments

@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>[email protected](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.

dsyme avatar Jul 21 '20 13:07 dsyme

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.

kurtschelfthout avatar Dec 13 '20 13:12 kurtschelfthout