locked
Utilizing Pre-Build and Post-Build Events RRS feed

  • Question

  • Using VS2003 - C# I've built an application that consists of a WinForms app and a Windows Mobile app.  I have a series of steps I take to compile a new setup package.  I'm content with this process, even if it isn't a one-click process.

    But I'm about to expand things by introducing two additional WinForms app compilations - one for a trial version and one for a special read-only version.  In order to accomplish this I'm going to need to constantly update a few properties in assorted text files such as App.config.

    I've been researching the easiest way to do this automatically and am thinking that perhaps using the pre-build and post-build events that I see in the Project Properties is the answer.

    To this end, I have some questions:
    1. Would you agree that this is the best approach or would you suggest another?
    2. If the former then into the pre/post build textboxes, am I to enter an EXE that I've specially built for this purpose?
    Sincerely,

    Robert W.
    http://PocketPollster.com
    Saturday, March 17, 2007 1:31 AM

Answers

  • There are several ways of doing this:

    - one is to use those pre/post build events, but they require an external app to modify settings, which will cause the warning "the document was modified outside the editor. Do you want to reload it?" or similar.

    - other is to use VS automation to capture the EnvDTE.BuildEvents. See:

    HOWTO: Canceling a build from a Visual Studio .NET add-in.

    http://www.mztools.com/resources_vsnet_addins.htm

    - another is to capture the build commands, not the build events. See:

    HOWTO: Capturing commands events from Visual Studio .NET add-ins

    http://www.mztools.com/resources_vsnet_addins.htm

    - yet another is to provide your own commands to initiate the build rather than capturing build events. See:

    Automating Builds and Configurations in Visual Studio .NET

    http://msdn2.microsoft.com/en-us/library/aa290092(VS.71).aspx

     

     

     

    Saturday, March 17, 2007 11:39 AM