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

Trying to read resx files from wrong folder? #46

Closed bjartwolf closed 9 years ago

bjartwolf commented 9 years ago

This might just be me having configured something wrong... The project works fine locally but the resource file reader breaks when I deploy to test environments.

I am trying to figure out where the Resource type provider is finding the filepath from. Locally everything works fine, but when I deploy my project ResXProvider seems to try to read the file from a path on my buildserver. Everything works if I actually go and put the resource file in the buildpath folder, so there is only some issue with where the system tries to go and find the resource file.

System.IO.DirectoryNotFoundException: Could not find a part of the path 'E:\TeamCity\BuildAgent3\work\d15d54883fe35cc\MyProject\Resources1.resx'. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) at System.Resources.ResXResourceReader.EnsureResData() at System.Resources.ResXResourceReader.System.Collections.IEnumerable.GetEnumerator() at Microsoft.FSharp.Collections.SeqModule.Cast@963.Invoke(Unit unitVar0) at Microsoft.FSharp.Collections.SeqModule.revamp@914.Invoke(Unit unitVar0) at Microsoft.FSharp.Collections.SeqModule.TryFind[T](FSharpFunc2 predicate, IEnumerable1 source) at Microsoft.FSharp.Collections.SeqModule.Find[T](FSharpFunc2 predicate, IEnumerable1 source) at FSharp.Configuration.ResXProvider.readValue(String filePath, String name) in l:\github\FSharp.Configuration\src\FSharp.Configuration\ResXProvider.fs:line 20

bjartwolf commented 9 years ago

I also get the same behavior locally, it is is looking for the resource file in the source code directory. I can't publish all the source code right now, unfortunately. The only difference from your test project I can see is that I am using F# 3.1 (4.3.1.0) instead of 3.0 as the test project. I did have some issues including the resource file (I can not find a way to create Resource files from Visual Studio as in C# projects, so I ended up taking yours from the test project and changing it, which did work except for the fact that I could not change name of the resource, it had be called Resource1.resx... This might just be an issue with using resx files in F#, it doesn't seem like the tooling is that good (I am using VS2013 premium update 3)?

I am reverting to using app.config for the strings for now, but it would be nice to be able to use resource files.