What Was I Thinking?

Follies & Foils of .NET Development
posts - 95 , comments - 352 , trackbacks - 0

How to get Pre-Build Event support for Web Site Projects

In Visual Studio (2008) Web Site Projects do not support pre/post build events.  Web applications do, but web sites do not.

 

This doesn’t mean you can’t have pre/post build events however.  You just have to be a little creative.

 

In my scenario, I needed a pre-build event to fire. 

1. I added a new class library project to my solution and configured its post build event to execute the pre-build event I wanted. 

2. I added a project dependency on the Web Site of the new class library.

Right click the solution explorer on the solution node.

Select Project Dependencies.

Select the web site in the project list dropdown at the top of the dialog.

Check the new class library project on the list of available projects.

Close the dialog.

Now when my web site builds, it builds my new class library, which in turn executes its post-build event.  The result is custom logic executing before my web site is built.  SUCCESS!

Print | posted on Saturday, January 30, 2010 4:01 PM | Filed Under [ Visual Studio ]

Feedback

Gravatar

# re: How to get Pre-Build Event support for Web Site Projects

I am always interested in internet security tutorials. My opinion is that your solution here could be modified to actually offer an extra degree of security to certain web applications.
5/10/2011 7:27 AM | James
Gravatar

# re: How to get Pre-Build Event support for Web Site Projects

I love to play this exciting and entertaining game fireboy and watergirl online free with my friends and sahre this cool math game to the others.Thanks for sharining this game with us.
9/30/2017 6:22 PM | R_Ashwin
Post A Comment
Title:
Name:
Email:
Comment:
Verification:
 

Powered by: