Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8687889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:13:27+00:00 2026-06-12T23:13:27+00:00

Currently I have a post-build event configured in my web project using Visual Studio

  • 0

Currently I have a post-build event configured in my web project using Visual Studio 2012 like this:

enter image description here

This basically calls a PowerShell script to add a copyright notice to every .cs file.

What I’d like to do is to execute this powershell script only before Publishing the web app to the remote server. Doing so I won’t experience a delay every time I need to debug the project. Do you know of any way of accomplishing this?


According to Sayed’s answer, I customized a specific publish profile and added this:

<PipelineDependsOn>
  CustomBeforePublish;
  $(PipelineDependsOn);
</PipelineDependsOn>
</PropertyGroup>
<Target Name="CustomBeforePublish">
<Message Text="******* CustomBeforePublish *******" Importance="high" />
<Exec Command="powershell.exe -file &quot;$(ProjectDir)\Copyright.ps1&quot;" />
</Target>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T23:13:29+00:00Added an answer on June 12, 2026 at 11:13 pm

    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 a target into the publish process, before the publish actually occurs. You can do that by extending the PipelineDependsOn property as below.

    <PropertyGroup>
      <PipelineDependsOn>
        CustomBeforePublish;
        $(PipelineDependsOn);
      </PipelineDependsOn>
    </PropertyGroup>
    
    <Target Name="CustomBeforePublish">
      <Message Text="********************************** CustomBeforePublish ***********************************" Importance="high"/>
    </Target>
    

    FYI regarding the customization of .wpp.targets, that was the only technique which we had for VS2010. My recommendation here is as follows; customize the .pubxml file for most cases and to only create a .wpp.targets file if you want to customize every publish of the given project.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently using a post build event in my project to copy my assemblies
I have two questions re: visual studio 2008 and post-build events. 1) How do
I have a solution with several projects, where the startup project has a post-build
We have a Visual Studio 2010 project that comprises of a bunch of C
I have it currently so that my post title links to an external URL
I have to add image as attachment in post in wordpress. Currently image is
I'm currently implementing a client application that POST's a file over HTTP and have
currently, this is the preg_replace string that I have. $mtg_post['post_content'] = preg_replace([^\\x20-\\x7e], ,$ability); This
Currently have password protection on my main and sub directories, however I'd like to
I currently have one project that currently contains multiple packages. These packages make up

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.