in

Corey Roth and Friends Blogs

Group site for developer blogs dealing with (usually) Ionic, .NET, SharePoint, Office 365, Mobile Development, and other Microsoft products, as well as some discussion of general programming related concepts.

Kyle Kelin on .Net

Post Build Actions Are Evil

This post is in response to the last SharePoint project I was on. Though this wasn’t the first time I have seen this. The developer was using wsp builder and a file called PostBuildActions.bat that was executed when they built their solution. This allowed him and other developers to simply hit F5 to build the solution and deploy it locally to their SharePoint environment. The problems started when the solution grew. It was up to 19 projects when I saw it and most projects had a bat file that was copying assemblies and ascx files after building in order for the wsp builder to work. As you can imagine this was pretty complex and unmanageable. And the build times were over 5 minutes long. Build times this long really interfere with a developers flow. I would hit F5 got get a cup of coffee or minimize the vpc and surf the web. Not a very good use of my time so I decided to cut this down.

There are three solutions that you could take:

1. Create additional build modes to Debug and Release

Use Debug and Release for compile only and create a DebugDeploy and ReleaseDeploy that will then call your PostBuildActions.bat. The does speed up the process because we now can just build if we wanted. But it still to me seemed difficult for a new developer to catch on.

 

2. Create a manual deploy file

This is the method I chose. I removed all post build actions and copied those files into one large bat. I ended up creating two bat files, one called buildwsp.bat that copied all the files necessary assemblies and ascx files and included the wsp builder commands to create the wsp file. Next I created a file called deploy.bat that would rectract and redploy the solution package. The process was hit F5, then click buildwsp, then finally deploy. I had the two bat files on my task bar for easy use. This cut down the total deployment to about 2 minutes but it also gave me the flexibility to quickly build in just under 30 seconds.

 

3. Use MSBuild

I didn’t use MsBuild in this situation because I didn’t have a lot of time and I don’t know MSBuild. For my next SharePoint project though I am going to use this. I think this could give me the speed and flexibility I have been wanting. There are even some MsBuild templates for SharePoint out on CodePlex.

Comments

No Comments

Leave a Comment

(required)  
(optional)
(required)  
Add

About KyleKelin

Kyle Kelin has been implementing software in the Microsoft space for the past 6 years mainly as a consultant. His interests are SharePoint, .NET, JQuery, and Silverlight.
2019.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems