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#.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With