如何在Visual Studio中调试的控制台应用程序中设置命令行参数?我已经在Eclipse中完成了此操作,Visual Studio中是否有类似的选项?
最佳答案
可以在项目的Command Line Arguments
窗口的Debug
标记中设置Properties
:
或者,可以选择将StartArguments
元素添加到.csproj.user
文件:
<?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>