Use --target:library to compile to a library (e.g. to create bar.dll).

Then use --target:exe and -r:bar.dll to make an executable that references the library you just build.

(Alternatively, just compile it all together into a single assembly; e.g. "fsc bar.fs main.fs".)

Don't use --target:module, netmodules are a CLR thing that no one uses or understands. :)

By on 11/12/2010 2:31 PM ()

Thanks - that did the trick! I now have an executable program.

But there's a problem. The program uses third party dotnet assemblies (DLLs) and throws the following exception on startup:

1
2

Unhandled exception:System.IO.FileNotFoundException:  Could not load file or assembly 'ESRI.ArcGIS.DataSourcesGDB, ...' or one of its dependencies.  The system cannot find the file specified.
at <StartupCode$Resolver>.$Resolver\$Main.main@()

I tried to include the assembly in a static manner using fsc --standalone, but omitting that switch does not change the exception.

How can I get my program to load these assemblies? I checked DataSourcesGDB's manifest using ILDASM.exe and have referenced all of its dependencies (with fsc -r filename.dll). Is this what the --staticlink:file option is for? FYI, the F# interpreter is able to load these properly using #I and #r directives.

Thanks again.

Ken

By on 11/12/2010 11:18 PM ()