Saturday, February 24, 2007

Adding Pre and Post build events to Web Projects

It is amazing how often I come across things in Visual Studio that seem like they should be simple enough.

Recently, one such thing was adding a post-build event to a Web Project. Of course the first place to look is the project properties. But there is no sign of it there. A little odd, why shouldn't I be able to have events on my build for a Web Project?

You can! A quick investigation of the .csproj project file in your project path shows the PreBuildEvent and PostBuildEvent configuration values sitting there. And you can edit them with your favorite editor and add in you pre and post events as you wish.

To easy - when you don't try to use the Visual Studio IDE!


<VISUALSTUDIOPROJECT>
  <CSHARP>
    <BUILD>
      <SETTINGS>
        <!-- Your Build Events Here -->
        PreBuildEvent = ""
        PostBuildEvent = ""
        <!-- RunPostBuildEvent = "Always" | "OnBuildSuccess" | "OnOutputUpdated" -->
        RunPostBuildEvent = "OnBuildSuccess"
      </SETTINGS>
    </BUILD>
  </CSHARP>
</VISUALSTUDIOPROJECT>

kick it on DotNetKicks.com Shout it

3 comments:

Anonymous said...

Are you referring to web application projects? Web site projects don't have csProj files.

cheap viagra online said...

Hello, I do not agree with the previous commentator - not so simple

willam said...

Web Development bahrain
Web development Bahrain is a team of qualified and experienced Web Developers who are capable of handling projects of any size and can deliver the completed project on time. The main motto of Web development Bahrain is our customer satisfaction.