The debug tab of the project properties for a console application in VS2010 allows me to set command-line parameters to pass to the project whilst debugging.
I would like to set a parameter which is a path and the path is specific to each developer/machine, as it is a path which resides in the solution folder and each environment is different.
For pre- and post-build events, I can use macros such as $(ProjectDir)
, but I can't find a way to do this for command-line parameters - is there a way? A hack is fine, as long as it's not too awful!
Thanks
How to Pass Command Line Arguments using Visual Studio ? 1 Right Click on Project from Solution Explorer and Select Properties. 2 In the Project Properties Windows, Navigate to “Debug Tab” 3 You will find the text box “Command Line”
Visual Studio enables nice features where you can do this on the Debug tab. Here are the steps to achieve this. 1. Right Click on Project from Solution Explorer and Select Properties. 2. In the Project Properties Windows, Navigate to “Debug Tab”. 3. You will find the text box “Command Line”.
Launching from command line # You can launch VS Code from the command line to quickly open a file, folder, or project. Typically, you open VS Code within the context of a folder. To do this, from an open terminal or command prompt, navigate to your project folder and type code.:
Visual Studio Code has a powerful command line interface built-in that lets you control how you launch the editor. ... On macOS, you need to manually run the Shell Command: Install 'code' command in PATH command (available through the Command Palette ⇧⌘P (Windows, Linux Ctrl+Shift+P)).
I haven't found a way to use $(ProjectDir)
in the command line arguments, but you can access files contained within the project by:
$(ProjectDir)/FileNeededDuringRuntime
to FileNeededDuringRuntime
.This is more of a hack since it probably doesn't cover all the cases of using the variable, but it may get you by if you're just referencing a few files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With