locked
Rebuild All issue RRS feed

  • Question

  • I need to be able to run a command line to stop a service when I run a rebuild all because during the clean part of the rebuild step there is an error because the service exe cannot be deleted. The obvious solution would to be to add it to prebuild step, but that is not early enough and doesn't work for me. I thought about adding another project to the solution that is build first and adding the in there, but I really don't like that idea. Any other suggestions?

    Thanks
    Friday, October 2, 2009 3:47 PM

Answers

  • Approach it from the other end. Write a post-build event that copies the executables to another folder, and start the service using the copied files.
    Friday, October 2, 2009 6:08 PM
  • Hello,

    Thanks for your post.

    I agree with Brain, the simplest way might be copy the executables to another folder and register the copied files as the service. As per researches, the removal the output files is encapsulated by VCBuild. Even if I delete the $(TargetPath) in the "Extensions to Delete on Clean" property, the output files are still deleted.

    http://msdn.microsoft.com/en-us/library/8x480de8.aspx

    It seems we cannot add our build event before the cleaning process. Another suggestion is that we can write a Visual Studio addin or Macros. The Add in or Macro kills the service and calls the DTE.ExecuteCommand Method to rebuild the solution. If you have difficult in extending Visual Studio, please post on our VSX forum.

    http://social.msdn.microsoft.com/Forums/en-US/vsx

    A good new is we can easily do this in Visual Studio 2010. As VC++ project file is a MSBuild formatted project in Visual Studio 2010, to add a customized step before cleaning process, we just need to override the BeforeClean target.

    Thanks,
    Rong-Chun Zhang
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg[at]microsoft.com
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Monday, October 5, 2009 7:00 AM

All replies

  • Why doesn't it work?  Try pskill.exe

    Hans Passant.
    Friday, October 2, 2009 4:47 PM
  • The problem is I don't know how to run a command before the "clean" step of the "rebuild all"....

    clean < pre-build

    the clean fails because the file is locked and breaks the build
    Friday, October 2, 2009 5:44 PM
  • Approach it from the other end. Write a post-build event that copies the executables to another folder, and start the service using the copied files.
    Friday, October 2, 2009 6:08 PM
  • that is what i have done...but i failed to change the outputs under the custom build step to not include the location of where i copied it too.

    Friday, October 2, 2009 8:29 PM
  • I don't understand.
    Friday, October 2, 2009 9:09 PM
  • Hello,

    Thanks for your post.

    I agree with Brain, the simplest way might be copy the executables to another folder and register the copied files as the service. As per researches, the removal the output files is encapsulated by VCBuild. Even if I delete the $(TargetPath) in the "Extensions to Delete on Clean" property, the output files are still deleted.

    http://msdn.microsoft.com/en-us/library/8x480de8.aspx

    It seems we cannot add our build event before the cleaning process. Another suggestion is that we can write a Visual Studio addin or Macros. The Add in or Macro kills the service and calls the DTE.ExecuteCommand Method to rebuild the solution. If you have difficult in extending Visual Studio, please post on our VSX forum.

    http://social.msdn.microsoft.com/Forums/en-US/vsx

    A good new is we can easily do this in Visual Studio 2010. As VC++ project file is a MSBuild formatted project in Visual Studio 2010, to add a customized step before cleaning process, we just need to override the BeforeClean target.

    Thanks,
    Rong-Chun Zhang
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg[at]microsoft.com
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Monday, October 5, 2009 7:00 AM
  • If you have a custom build step you must specify "Outputs" or it won't run. The service was getting copied to another folder in the custom build step and the outputs pointed to the new location it was getting copied to. so i got rid of that and put it in the post build step as you suggested and it works now. Thank you.
    Monday, October 5, 2009 5:03 PM