简体   繁体   English

如何在VS2015中开始调试之前运行脚本\\可执行文件?

[英]How to run a script\executable before start debugging in VS2015?

I need to run a code generator before starting compilation\\execution of my code in Visual Studio 2015. 在Visual Studio 2015中开始对我的代码进行编译\\执行之前,我需要运行代码生成器。

Is there any way to add a script that will run my .bat.py file when I click "Start Local Debugger"? 当我单击“启动本地调试器”时,是否可以添加将运行我的.bat.py文件的脚本?

I use UnrealEngine 4 and in my project there already are some .cs files that use precompilation scripts, but these scripts are not fired if the project is already up-to-date. 我使用UnrealEngine 4,并且在我的项目中已经有一些使用预编译脚本的.cs文件,但是如果项目是最新的,则不会触发这些脚本。

Any solutions? 有什么办法吗?

Open properties of your startup project in VS (should be your game, not UE4). 在VS中打开启动项目的属性(应该是您的游戏,而不是UE4)。 You need Configuration Properties → Debugging . 您需要配置属性→调试

When you click Local Windows Debugger (this is what it's labeled in my VS) it runs whatever is specified under Command with Command Arguments . 当您单击“本地Windows调试器”(这是在我的VS中标记的名称)时,它会运行Command with Command Arguments下指定的内容。 UE4 projects usually have $(TargetPath) and "$(SolutionDir)$(ProjectName).uproject" specified but you can change it to run your .bat script and add custom logic. UE4项目通常指定了$(TargetPath)“ $(SolutionDir)$(ProjectName).uproject”,但是您可以更改它以运行.bat脚本并添加自定义逻辑。

However, if your project is not up to date, Build Command Line is going to be called before the debugger ( Configuration Properties → NMake ). 但是,如果您的项目不是最新的,则将在调试器之前调用“构建命令行”(“ 配置属性”→“ NMake” )。 For UE4 that would be UnrealEngine\\Engine\\Build\\BatchFiles\\Build.bat script. 对于UE4,它将是UnrealEngine \\ Engine \\ Build \\ BatchFiles \\ Build.bat脚本。 If you need your logic to run before Build.bat you can put it here. 如果您需要在Build.bat之前运行逻辑,可以将其放在此处。 Or replace this script with your own. 或者用您自己的脚本替换此脚本。

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

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