Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio set command arguments

I'm using Visual Studio 2013. Now, I have a few C# and C++ projects in a solution. Under project properties I can add some debugging properties. That works fine. But when I run the visual studio solution on another computer the command arguments are deleted.

How can I define default command arguments that are also available when I run the project on another computer?

like image 890
user2644964 Avatar asked Sep 20 '26 02:09

user2644964


1 Answers

If you are using other computer for debugging, then instead of setting the arguments in properties, set them via config file.

let's say following is your config file (by-default it is App.config),

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup> 
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<appSettings>
<add key ="key1" value ="Sample" />
</appSettings>
</configuration>

To get value of key1 use ConfigurationManager.AppSettings["key1"];. You can add multiple keys in <appSettings> tag.

like image 126
Abhishek Avatar answered Sep 21 '26 16:09

Abhishek