jamescourtney / FlatSharp

Fast, idiomatic C# implementation of Flatbuffers
Apache License 2.0
510 stars 51 forks source link

Compilation target fails when executable path (i.e. nuget cache path) contains spaces #376

Closed goldsam closed 1 year ago

goldsam commented 1 year ago

FlatSharp.Compiler.targets executes a command which does not quote the path to the compiler binary. This fails when your nuget cache path contains a space, as would be the default case when your username contains a space.

Current output from using FlatSharp.Compiler 7.1.1:

dotnet C:\Users\[redacted]\.nuget\packages\flatsharp.compiler\7.1.1\tools\net6.0\FlatSharp.Compiler.dll --nullable-warnings true --normalize-field-names true --gen-poolable false --input "fbs\service.fbs" --includes "[redacted]" --output obj\Debug\net7.0\
Could not execute because the specified command or file was not found.
Possible reasons for this include:
  * You misspelled a built-in dotnet command.
  * You intended to execute a .NET program, but dotnet-C:\Users\Sam does not exist.
  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.

Manually executing this command reproduces the failure and above output. The problem is resolved by quoting the first argument to dotnet containing the path the compiler binary.