Visual Studio:运行C ++项目后构建事件,即使项目是最新的 [英] Visual Studio: Run C++ project Post-Build Event even if project is up-to-date

查看:191
本文介绍了Visual Studio:运行C ++项目后构建事件,即使项目是最新的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Studio(2008)中,即使项目是最新的,也可以强制C ++项目的后构建事件运行?

In Visual Studio (2008) is it possible to force the Post-Build Event for a C++ project to run even if the project is up-to-date?

具体来说,我有一个项目,它构建一个COM进程内服务器DLL。该项目有一个后构建步骤,运行regsvr32.exe $(TargetPath)。这在重建上运行良好,但只有在对项目源进行了更改后才在构建上运行。

Specifically, I have a project which builds a COM in-process server DLL. The project has a post-build step which runs "regsvr32.exe $(TargetPath)". This runs fine on a "Rebuild", but runs on a "Build" only if changes have been made to the project's source.

如果我做一个做任何更改,Visual Studio只是报告项目是最新的,什么也不做 - 后运行事件不运行。有什么办法,我可以强迫事件在这种情况下运行?这是必要的,因为虽然DLL本身是最新的,注册信息可能不是。

If I do a "Build" without making any changes, Visual Studio simply reports that the project is up-to-date and does nothing - the Post-Build Event is not run. Is there any way that I can force the Event to run in this situation? This is necessary since although the DLL itself is up-to-date, the registration information may not be.

推荐答案

自定义构建步骤属性页设置要运行的批处理文件。如果未找到输出设置中指定的文件或过期,则会运行此选项。只需在那里指定一些不存在的文件,并且自定义构建步骤将始终运行。它将运行,即使您的项目是最新的,因为输出文件从未找到。

You can use the Custom Build Step property page to set up a batch file to run. This runs if the File specified in the Outputs setting is not found, or is out-of-date. Simply specify some non-existent file there, and the custom build step will always run. It will run even if your project is up-to-date, since the Output file is never found.

这篇关于Visual Studio:运行C ++项目后构建事件,即使项目是最新的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆