1

I want to execute a postbuild command after every build, no matter what project in my solution has changed.

To accomplish this in Visual Studio 2010, I made one empty project depend on every other project, so it always got built, executing its postbuild command. However, Visual Studio 2012 (RC) appears to recognize that the dependency is not real, and will not build this empty project automatically.

I do not see any way to specify a solution postbuild script in solution settings. How can I accomplish this?

Sander
  • 25,685
  • 3
  • 53
  • 85
  • There are pre and post build events that you can set: http://msdn.microsoft.com/en-us/library/ke5z92ks%28v=vs.80%29.aspx – Hunter McMillen Jul 06 '12 at 12:31
  • @HunterMcMillen Those events only affect one project. I want my command to be executed no matter what project(s) got built. – Sander Jul 06 '12 at 12:54
  • Do you want this just for one VS solution, or do you want it to happen regardless of the solution you're working in? – Jimmy Jul 10 '12 at 00:03
  • @Jimmy - Just one VS solution. – Sander Jul 10 '12 at 05:14
  • @Sander, does it recognize that the dependency isn't real (i.e. never consider building the project), or does it think that the project is already up to date? VS2012 had some changes to the incremental build logic, this might be a regression. – Jimmy Jul 11 '12 at 03:05
  • @Jimmy, I am not really sure how I can tell the difference between the two options. VS never builds this project after a change in any other project, only when I explicitly tell it to build it or when I change something in this project (I have a shared AssemblyInfo.cs with "global" values in there that is linked in the other projects). – Sander Jul 11 '12 at 07:49

2 Answers2

2

I have solved this issue by making my post-build script also delete the output (bin**) of this "empty" project, forcing a rebuild of this project every time. It appears to work satisfactorily so far.

Sander
  • 25,685
  • 3
  • 53
  • 85
  • 10
    That's great. However this being a top result on google, it would have been nice for you to post directions... This is an absolutely useless Q&A – Derek Ziemba Mar 26 '15 at 13:31
0

This works (for details see original post):

enter image description here

enter image description here

you may need to change security settings (at your own risk) e.g.: https://stackoverflow.com/a/60284384/2705777

Neil
  • 7,482
  • 6
  • 50
  • 56