c# - 构建时调用 exe 包括命令名称和参数
问题描述
我需要在 Pre-build 事件中调用 *.exe 文件并为 *.exe 定义命令和参数。我试着这样做:
<PropertyGroup>
<PreBuildEvent>cmd /c D:\...\File.exe commandname -tt="option" -opt="option2"</PreBuildEvent>
</PropertyGroup>
当我开始重建时,什么也没发生。应用程序重建成功,但 .exe 从未调用。
UPD
我也试过这样,但-opt
在执行时为空:
<PreBuildEvent>call D:\...*.exe generate -opt="option"</PreBuildEvent>
解决方案
这个变体对我有用:
<PropertyGroup>
<PreBuildEvent>"some.exe" "somecommand" "-opt=some option" "-opt2=one more opt"
</PreBuildEvent>
</PropertyGroup>
推荐阅读
- java - 如何在同一台机器上运行数百个 Kafka 消费者?
- lucene - Hibernate Search 手动索引抛出“org.hibernate.TransientObjectException:实例未与此会话关联”
- vba - 为什么我需要 Int 函数
- docker-compose - 将现有卷附加到 docker 容器
- sql-server - SQL Server 时间数据类型与 Excel 不兼容?
- php - 将查询 LEFT JOIN 更改为 FULL OUTER JOIN(尊重空值) - 如何更改它(之后没有可怕的性能)?
- sccm - 从一个远程位置在多个 SCCM 客户端中启动软件更新
- google-apps-script - 激活并运行录制的宏到多个 Google 电子表格/工作簿
- swift - 如何在 Swift 中的 Xcode 的 IB 中设计表头
- javascript - Nuxt auth getToken witnin async 未定义