简体   繁体   English

我想访问visual studio命令propmt并使用C#代码运行.bat文件

[英]I want to access visual studio command propmt and run a .bat file using C# code

我已经为自动部署创建了.bat文件,我想访问visual studio命令propmt并使用C#代码运行.bat文件。

If you're talking about deployment processes, you're in the build, and you may want to consider using MSBuild directives; 如果您正在讨论部署过程,那么您正在构建中,并且您可能需要考虑使用MSBuild指令; just open your project file in a text editor and add an Exec line. 只需在文本编辑器中打开项目文件并添加Exec行。 I recommend using conditionals so it only executes in "release" mode, since a deployment script rarely has a place in debug builds. 我建议使用条件,因此它只在“发布”模式下执行,因为部署脚本很少在调试版本中占有一席之地。

To run other processes from C# code, see Process.Start . 要从C#代码运行其他进程,请参阅Process.Start Keep in mind this may require executing the VS Command Prompt with parameters to start your batch script. 请记住,这可能需要使用参数执行VS命令提示符以启动批处理脚本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM