Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Post Publish Events

For normal (say Windows Forms) C# applications, to execute commands after a successful build I would use the Build Events->Post-build event command line in Project Properties.

I have a Web Site project which I "Publish", using the "Publish..." command in the context menu in the solution explorer.

Is there a way to run commands after the successful publish and if so how is it done? (eg a Post-Publish event command line field)

Visual Studio 2008, ASP .Net Web site project, C#.

like image 272
Russell Avatar asked Sep 01 '09 04:09

Russell


People also ask

What are post build events?

Pre/Post build events are useful when we wish to perform some operation before/after a project is built. These operations are nothing but the Shell commands being used from the command line. A build event can be formed using a single, multiple, or conditional commands.

What is MSBuild target?

A target element can have both Inputs and Outputs attributes, indicating what items the target expects as input, and what items it produces as output. If all output items are up-to-date, MSBuild skips the target, which significantly improves the build speed. This is called an incremental build of the target.


1 Answers

Update: Since Publish Web does not apply to folder-based web site projects, this answer assumes you are asking about a Web Application project.

You can't do this from inside the VS IDE. However, you can edit your project file in Notepad or your favorite XML editor and add a new target at the end of the file called AfterPublish.

You might want to read a bit more on MSBuild if you are not sure what you can do in this target.

You can find more details on extending the build process in VS at MSDN - HowTo: Extend the Visual Studio Build Process.

like image 117
Franci Penov Avatar answered Sep 23 '22 04:09

Franci Penov