compiler-constructionf#cscfsc

How to include app.config file with fsc.exe (F#) or csc.exe (C#)?


I have a console application that uses an app.config file however I can't figure out how to include that in the command line parameters so that the output will create the Program.exe.config when I compile it programmatically with fsc.exe. Right now my workaround is just to rename app.config to Program.exe.config and copy it to the same output location as Program.exe. What I need is the fsc.exe command line arguments to do this, however I suspect that csc.exe will have something identical or quite close to what fsc.exe does, so if you know what it is in csc.exe I'll try it out.

Bob


Solution

  • I don't think the F# compiler has any built in support for copying app.config to the output directory. Simply copying & renaming the file should do the trick - there is nothing more complicated going on.

    If you want to get this done automatically, you can add a post-build event like this:

    copy $(ProjectDir)app.config $(TargetDir)$(TargetFileName).config