Describe the bug
Installing fornax as a local tool on a CI server and trying to build a site throws an error "Couldn't find or load config".
To Reproduce
- Create a fornax site (e.g. using
fornax new)
- Add a
dotnet-tools.json with instructions to install fornax locally
- Add a config file for your chosen CI platform which runs
dotnet tool restore and dotnet fornax build
- Push your site to a git repo and build using the CI service of your choice (e.g. TravisCI, Netlify, Azure Pipelines, etc.)
- Watch the build fail and observe the printed error
Couldn't find or load config.
Expected behaviour
The site should build.
Build Output
Below is the output from TravisCI. The same problem occurs on Azure Pipelines as well as Netlify.
dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.1.201
Commit: b1768b4ae7
Runtime Environment:
OS Name: ubuntu
OS Version: 16.04
OS Platform: Linux
RID: ubuntu.16.04-x64
Base Path: /usr/share/dotnet/sdk/3.1.201/
Host (useful for support):
Version: 3.1.3
Commit: 4a9f85e9f8
.NET Core SDKs installed:
3.1.201 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
$ dotnet tool restore
$ pwd
/home/travis/build/LukeBurgessYeo/fsharp-tutorial
The command "pwd" exited with 0.
$ ls
config.fsx images _lib loaders README.md style
generators js LICENSE posts Script.fsx
The command "ls" exited with 0.
$ dotnet fornax build
Couldn't find or load config
The command "dotnet fornax build" exited with 1.
Notice that the working directory contains a config.fsx.
Additional Thoughts
Fornax works as expected locally with the globally installed dotnet tool, as well as with the locally installed dotnet tool. It seems that on these CI servers, the directory which dotnet fornax build is being run from is not the same as the directory which is being passed into the build process (i.e. this path from Directory.GetCurrentDirectory()).
Describe the bug
Installing fornax as a local tool on a CI server and trying to build a site throws an error "Couldn't find or load config".
To Reproduce
fornax new)dotnet-tools.jsonwith instructions to install fornax locallydotnet tool restoreanddotnet fornax buildCouldn't find or load config.Expected behaviour
The site should build.
Build Output
Below is the output from TravisCI. The same problem occurs on Azure Pipelines as well as Netlify.
Notice that the working directory contains a
config.fsx.Additional Thoughts
Fornax works as expected locally with the globally installed dotnet tool, as well as with the locally installed dotnet tool. It seems that on these CI servers, the directory which
dotnet fornax buildis being run from is not the same as the directory which is being passed into the build process (i.e. this path fromDirectory.GetCurrentDirectory()).