Question

I have an F# script that I intend to use both at home and at work. The script shall work similarly in both places, yet, I have a set of issues to deal with at work (mostly regarding firewalls and http proxies) so I'd like to run my script in a slightly different way in one case and in the other.

I imagine that ideally I'd set a special flag (directive) at the FSI level, so I could have #if AT_WORK to deal with some sharp corner cases.

How to accomplish this?

Était-ce utile?

La solution

Yes, you can define your own symbols to use with conditional compilation, when you call FSI do it like this:

Fsi.exe --define:AT_WORK yourScript.fsx

See http://msdn.microsoft.com/en-us/library/dd233172.aspx

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top