Terminology note: .fs files are not "scripts", they are source code that will be compiled. .fsx files are scripts, these are bits of code meant to be run by the interactive window (FSI).

That said, what you said should work, but note that 'file order matters', meaning Common.fs must appear before the other files; see second half of

[link:lorgonblog.spaces.live.com]

By on 12/4/2008 3:47 PM ()

That makes sense about the code vs. script files.

That did the trick, I moved the Common.fs to the top of the file listing in my F# project and now it working properly.

Thanks a bunch!

By on 12/4/2008 4:18 PM ()

I've developed a new problem that I think might be related to this. I opened up my project this morning as I thought up a better way to fix a small bug I was having.

in My Script.fsx scipt I have the following code

#light
// This file is a script that can be executed with the F# Interactive.
// It can be used to explore and test the library project.
// Note that script files will not be part of the project build.
#load "Replace.fs"
open Replace
let original = "me-full-of dash"
let replaced = ReplaceDashesWithSpaceDashSpace original
printfn "DashReplace with Space Dash Space, original: %s after: %s" original replaced

However, there is an error on the #load "Replace.fs" line. I receive the following error:

One or more errors in loaded file. Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved

Making it seem there is a problem with my Replace.fs code. However, if I comment out all the code in Script.fsx and rebuild I receive no more errors.

Any ideas on what is causing this?

-Chris Treml

By on 12/7/2008 12:03 PM ()

Is Replace.fs part of the project? If you open Replace.fs in the editor, do you see errors? Does Replace.fs depend on some other file (e.g. Common.fs) that the script is not loading?

By on 12/7/2008 1:37 PM ()

Replace.fs is part of the project.

When I have Replace.fs open in the editor no errors are shown.

Replace.fs does depend on another file (Common.fs)

Common.fs does not show any errors when I have it open in the editor

I have posted the project on Skydrive here: [link:cid-1ab113d6b9c0d34e.skydrive.live.com] if that is of help.

By on 12/7/2008 2:07 PM ()

I haven't looked at the project; from the description it sounds like this is expected behavior.

Either the script needs to #load Common.fs before #load-ing Replace.fs, or else you should have the script reference the compiled project's DLL (rather than the source), using #r. Probably the latter. See also

[link:blogs.msdn.com]

#load just brings in that one source file. Does it make sense?

By on 12/7/2008 3:56 PM ()

That makes sense, I'll just have to make sure I keep my mind wrapped around the idea of .fs being compile code and .fsx being scripts. I was thinking my in terms of what python does before.

Although I wasn't able to get the #r command to work properly (I loaded Common.fs and that worked for me).

I read through that link and tried the following:

#i @"C:\Users\Chris\Documents\Visual Studio 2008\Projects\Renamer\MassRenamer\MassRenamerEngine\bin\Debug"

#r "MassRenamerEngine.dll"

and I received an error saying MassRenamerEngine.dll could not be found. Am I using the #r command improperly?

By on 12/8/2008 7:17 AM ()

Looks ok - have you built the project (does the DLL exist there on disk)?

By on 12/8/2008 9:49 AM ()

Yep full path to the file is

C:\Users\Chris\Documents\Visual Studio 2008\Projects\Renamer\MassRenamer\MassRenamerEngine\bin\Debug\MassRenamerEngine.dll

By on 12/8/2008 9:54 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper