AfterPublish target not working

后端 未结 5 1096
抹茶落季
抹茶落季 2020-12-01 10:40

World\'s simplest task (see below) is not being executed after I publish my web application project. Any idea why?


  <         


        
5条回答
  •  不思量自难忘°
    2020-12-01 10:58

    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 whose "AfterTarget" attribute's value is set to "MSDeployPublish" - the "Name" attribute's value does not matter (as long as it's unique among target names).

    Here's how to do it:

    • Open the project file (e.g. *.csproj) in a text/XML editor and, just before the closing tag, add a element; pick a name of your choice for "CustomPostPublishAction".
    • Add a so-called Task child element that performs the desired action; for instance, to add a command to be passed to cmd.exe, use an element.

    Example:

    
        
    
    

    Note:

    • In command strings, use XML entity(?) references in place of characters that would break XML parsing, e.g. ">" in place of "<".
    • For documentation of the element in general, see http://msdn.microsoft.com/en-us/library/t50z2hka.aspx
    • Task-elements reference here: http://msdn.microsoft.com/en-us/library/7z253716.aspx
    • In general, if you need to determine the name of the msbuild.exe target that is actually invoked by Visual Studio 2010, do the following:
      • Go to Tools/Options..., Project and Solutions/Build and Run, select 'Detailed' (or, for even more information, 'Diagnostic') from the dropdown list labeled 'MSBuild project build output verbosity.
      • After running the build/publish action, e.g. Build/Publish, examine the Output window for the last occurrence of the string "Done building target" to determine the top-level target that was invoked.

提交回复
热议问题