question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Paket auto-generate scripts uses wrong current directory with type providers

See original GitHub issue

I’m sceptical if this is a Paket issue per se but interested if anyone else has seen this: -

#load @"..\..\paket-files\include-scripts\net452\include.main.group.fsx"
/// load some other files

open FSharp.ExcelProvider
/// open some other namespaces

type Component = ExcelFile< @"..\..\data\DataFile.xlsx">

This appears fine in the IDE (Code or VS) but when compiled gives this error: -

BatchImport.fsx(20,18): error FS3033: The type provider 'ExcelProvider.ExcelProvider+ExcelProvider' reported an error: Could not open file 'c:\Users\Isaac\Source\Repos\myProject\paket-files
\include-scripts\net452\..\..\data\DataFile.xlsx'. DirectoryNotFoundException - Could not find a part of the path 'c:\Users\Isaac\Source\Repos\myProject\paket-files\data\DataFile.xlsx'.

Note that the path it’s using is relative to where the paket script was loaded, rather than where the script I’m working in was loaded. Is this: -

  • A Paket issue?
  • An ExcelProvider issue?
  • Something more fundamental with how scripts are loaded within the context of F# and Type Providers?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
smoothdevelopercommented, Feb 13, 2017

@isaacabraham I’ve used the FSharp.Data.SqlClient and few other type providers from such scripts, although I always SOURCE_DIRECTORY as a reference, I think it would solve your problem:

type Component = ExcelFile< const(__SOURCE_DIRECTORY__ + @"/../../data/DataFile.xlsx") >
0reactions
isaacabrahamcommented, Jul 13, 2017

Yeah, __SOURCE_DIRECTORY__ fixes the problem I think.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ability to specify the directory to run poetry in instead of ...
I'm developing a command line script that depends on the working directory. It's actually a tool for working with git repositories, so it ......
Read more >
Mono executes program with wrong current directory
I have tried to create absolute paths from relative paths in the program using Path.GetFullPath() and Environment.CurrentDirectory but ...
Read more >
How to execute a script in a different directory than ...
So you give wrong path. The dot there doesn't mean "execute". It's just part of the path. In shell you normally type either...
Read more >
release-notes
A dependency manager for .NET with support for NuGet packages and git repositories.
Read more >
Command: plan | Terraform
The terraform plan command creates an execution plan, which lets you preview the changes that Terraform plans to make to your infrastructure.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found