Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging Windows Forms application that accepts command line arguments in Visual Studio

Tags:

.net

I created the application in Windows Forms that checks, if it contains specific command line arguments and acts accordingly.

Now I would like to test/debug my code with different command lines arguments.

I entered command line arguments by clicking on my project and choosing Properties/Debug. But when I start the debugging, I receive following message

The current project settings specify that the project will be debugged with specific security permissions. In this mode, command line arguments will not be passed to the executable.

In Properties/Security, "This is full trust application" is selected, so I am not sure why it is complaining.

like image 540
user850010 Avatar asked Jul 18 '11 19:07

user850010


2 Answers

You have setup ClickOnce publishing for this project, which adds a security restriction preventing command line parameters from being processed.

To remove the security restriction:

  • Open Project Properties
  • Go to the Security tab
  • Unchecked the "Enable ClickOnce Security Settings"
like image 200
Eric J. Avatar answered Nov 08 '22 18:11

Eric J.


Go to the project properties Security tab and do this:

  1. Click 'This is a partial trust application'
  2. Click Advanced Button (toward the bottom)
  3. Unclick 'Debug this application with the selected permission set'
  4. Click OK
  5. Click 'This is a full trust application' (this will undo step #1)

(Forum post "command line arguments will not be passed" message.)

like image 35
olegivo Avatar answered Nov 08 '22 18:11

olegivo