2

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

Beaker
  • 2,804
  • 5
  • 33
  • 54

1 Answers1

5

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
Tomas Petricek
  • 240,744
  • 19
  • 378
  • 553
  • +1 for the post build event, although I'm compiling programmatically with fsc.exe so I don't think I would be able to use it in this specific scenario. I'll mark this as the answer if no one else comes up with anything. – Beaker May 22 '11 at 18:36
  • 1
    @Beaker : The post-build event is part of the project file, which is built by MSBuild. If you used MSBuild instead of invoking fsc directly, this would be automatically taken care of for you. – ildjarn May 22 '11 at 19:33
  • @ildjam - Thanks, I knew it wouldn't apply to my scenario, I just thought it was a cool little tidbit of knowledge in general. I thought about MSBuild instead of fsc.exe, but figured it might be a little bit overkill for my specific scenario. – Beaker May 23 '11 at 17:08