fsprojects / FSharp.Configuration

The FSharp.Configuration project contains type providers for the configuration of .NET projects.
http://fsprojects.github.io/FSharp.Configuration/
Other
114 stars 63 forks source link

Creation of temp dll when run from fsi #119

Open richardjharding opened 7 years ago

richardjharding commented 7 years ago

I'm using FSharp Configuration Yaml config provider from an fsx script which is in turn run as part of a scheduled job

This seems to be leaving behind a randomly named temp assembly eg tmpc19f.dll each time its run (which I assume is the representation of the yaml file?) - and sometimes this results in an error "file already exists" - deleting the temp dlls removes the error.

Is this expected and can I change this behaviour?

vasily-kirichenko commented 7 years ago

Yes, it's how type providers work. About generating truly unique names for the temporary assemblies, I've no idea if it's supported OOB. /cc @dsyme

richardjharding commented 7 years ago

So Am I better off building a console app exe than using fsx which generates a new one for the same file each time its run?

vasily-kirichenko commented 7 years ago

We use Path.GetTempFileName(). I can change it to something like Guid.NewGuid().ToString() to avoid collisions.

So Am I better off building a console app exe than using fsx which generates a new one for the same file each time its run?

Yes, it would be more reliable I think. Another option can be to use FAKE to run the script - it caches generated assembly automatically.