【发布时间】:2018-08-25 18:40:40
【问题描述】:
我正在尝试运行一个可执行文件以在 Visual Studio 的构建后事件中更改我的应用程序配置。根据配置是调试还是发布,我想将参数传递给我的可执行文件,以便正确执行我的配置更改器。这是我所做的:
if $(ConfigurationName) == Release
(
"$(ProjectDir)ConfigurationGenerator\ConfigurationGenerator.exe" Release $(OutDir)applicationConfiguration.config
)
if $(ConfigurationName) == Debug
(
"$(ProjectDir)ConfigurationGenerator\ConfigurationGenerator.exe" Debug $(OutDir)applicationConfiguration.config
)
因此,在这种情况下,“Debug”和“Release”是参数 #1,“$(OutDir)applicationConfiguration.config”是参数 #2。每次我尝试运行我的应用程序时,它都会使构建崩溃,并在错误列表窗口中返回我,我的应用程序以退出代码 3 停止。有什么想法吗?
【问题讨论】:
-
你已经描述了你做了什么,但你没有描述它有什么问题。
-
好的,我来编辑一下
-
希望该实用程序不仅仅在失败时设置退出代码。在“输出”窗口中查找它吐出的诊断消息。通常,您需要将文件路径参数放在“双引号”中,这样路径中的空格就不会造成麻烦。退出代码有时等于 Windows 错误,3 == path not found.
标签: c# visual-studio post-build-event