Passing command line parameters with Visual Studio

2019-01-07 20:32发布

How do I set the command line arguments for an application I am developing using Visual Studio , it is a console application. I've done this on eclipse, is there a similar option on Visual Studio?

2条回答
疯言疯语
2楼-- · 2019-01-07 21:23

I would like just to add that menu shown on the picture could be accessed via Visual Studio 2010 Project Menu, then all the way down to the your project name properties.

查看更多
干净又极端
3楼-- · 2019-01-07 21:29

Something must be wrong with your Visual Studio if you don't see Command Line Arguments.

enter image description here

If you can't fix your Visual Studio, there is an option to add StartArguments element to your .csproj.user file:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <PublishUrlHistory />
    <InstallUrlHistory />
    <SupportUrlHistory />
    <UpdateUrlHistory />
    <BootstrapperUrlHistory />
    <ErrorReportUrlHistory />
    <FallbackCulture>en-US</FallbackCulture>
    <VerifyUploadedFiles>false</VerifyUploadedFiles>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
    <StartArguments>Argument1 Argument2</StartArguments>   <<== THIS LINE
  </PropertyGroup>
</Project>
查看更多
登录 后发表回答