7

In a projects settings, on the Debug tab, is there a way to use to use the project macro variables in the command line arguments box?

I know you can't use them directly because they don't get expanded but is there a clever solution to this?

EDIT: I'm using a C# project.

Adam Driscoll
  • 9,395
  • 9
  • 61
  • 104
  • If you want this supported, I suggested it to the VS team, you can vote for it at: http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/6350738-support-for-macros-in-debugging-command-line-argum – BlueTrin Aug 27 '14 at 09:11
  • 1
    This feature is now supported for C# **.NET Core** console apps. http://stackoverflow.com/a/41961568/2832598 – Gyromite Jan 31 '17 at 15:45

1 Answers1

6

No, this is supported [but not for C# projects].

Silly example I tried: Command Arguments = $(CharacterSet). Got "Unicode" at runtime for argv[1] inside main().

Select "Command Arguments", click on the dropdown arrow, Edit. Click Macros to see what macros are available.

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • I should have indicated that I am developing a C# app. – Adam Driscoll Oct 28 '10 at 20:01
  • 6
    Yes, you should have. The C# IDE doesn't support this. A possible workaround is a post-build event that writes a file that you read in your program. Like `echo $(ProjectName) > "$(TargetDir)cmdargs.txt` – Hans Passant Oct 28 '10 at 20:22