After Publish event in Visual Studio

UPDATE: seems like in VS 2019 and .NET 5 you can now use Publish target. <Target Name=”Test” AfterTargets=”Publish”> <Exec Command=”blablabla” /> </Target> Here’s my old answer that also works: MS has confirmed, that when publishing to file system they don’t have any target to launch after that. “We currently do not support executing custom targets … Read more

How to execute a PowerShell script only before a web deploy Publish task in VS 2012?

It depends on how you define before but below is one technique. When you create a publish profile with VS2012 it will create you a .pubxml file in the Properties\PublishProfiles folder (My Project\PublishProfiles for VB). These are MSBuild files and you can edit them to customize the publish process. In your case you can inject … Read more

Custom app_offline.htm file during publish

I know this is old but since I found a solution after looking here I thought I should provide an answer. VS 11 holds the publishing app_offline.htm file in this location: C:\Users\[user]\AppData\Roaming\Microsoft\VisualStudio\11.0\app_offline.htm I have tested this and customized it and it does work if you change this file. The down side, of course, is that … Read more

Post Publish Events

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 … Read more

Replicate VS2008 “Publish Web Site” from command line

The following command duplicates the Publish Web Site dialog with default settings. Command for Publish Web Site with Default Settings aspnet_compiler -nologo -v / -p “C:\WebSite1” -u “C:\TargetPath” Reference 1) See Community Content titled You want Publish a site but you have not Visual Studio then… at http://msdn.microsoft.com/en-us/library/20yh9f1b(classic).aspx. Microsoft Visual Studio 2005 > Visual Studio … Read more

AfterPublish target not working

Note: The following applies to VS2010 and publishing web-application projects with the “Web Deploy” publish method selected in the ‘Build/Publish {projectname}’ dialog. Julien Hoarau’s correct in that “Publish” is NOT the name of the msbuild target invoked in the above case; the actual target name is “MSDeployPublish”. Therefore, you have to define a “Target” element … Read more