VS 2010 post build,show application console

时间:2013-11-02 04:20:37

标签: c# visual-studio-2010 post-build-event

我设置了post build命令行,它将运行一个控制台应用程序(C#)。 VS运行应用程序,但我想看到控制台应用程序窗口。看起来VS创建过程没有窗口,所以我尝试使用

 [DllImport("user32.dll")]
 static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

但它也不起作用。

编辑 :(已添加命令行)

  

“C:\ AfterBuild.exe”“arg”“$(TargetDir)”

2 个答案:

答案 0 :(得分:3)

您可以使用“开始”命令启动新控制台并运行命令。

例如,创建一个这样的批处理文件,将其另存为test.bat:

@echo This is a test.

现在以此文件作为参数开始运行:

start test.bat

批处理文件将在新的控制台窗口上运行。

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/start.mspx?mfr=true

答案 1 :(得分:0)

如果有人希望在构建过程运行后使命令窗口保持打开状态:

cd "$(SolutionDir)MYPROJECTNAME\$(OutDir)\$(ConfigurationName)"

启动cmd / k MYPROJECTNAME.exe

相关问题