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 6904829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:06:34+00:00 2026-05-27T08:06:34+00:00

I have a solution with several web application projects in it. After all the

  • 0

I have a solution with several web application projects in it. After all the projects have been built I need to run an MSBUILD script.

What I used to do was call the script from one of the existing projects (through <Target Name="AfterBuild"> in the .csproj file). However, I had to make sure I used the project that built last, and if the build order ever changed I would get unexpected results.

So, I decided to make an empty web application project, and set the project dependencies so that it always built last, then attach the MSBUILD script to this.

So now it always runs at the right time, but I get an extra (tiny) assembly as a result of the supposedly empty project being built. There are no code files in the project (except AssemblyInfo.cs), but an assembly is always produced.

So, is there either a way to stop the assembly being built, or maybe a way to attach the MSBUILD script to the solution as a whole and avoid this dummy project altogether?

  • 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-05-27T08:06:34+00:00Added an answer on May 27, 2026 at 8:06 am

    In MSBuild 4.0 there are two new hooks that can be used to run scripts before and after a solution is built. When running MSBuild on a solution file, it will look for two target files in the solution directory:

    • before.SolutionName.sln.targets
    • after.SolutionName.sln.targets

    If any of those files is found, it will automatically be executed at the proper stage.

    In your case, in order to run a script after all the projects in the solution have been built, you could create an after.MySolution.sln.targets file with a Target like:

    <Target Name="RunPostBuildScripts" AfterTargets="Build">
        <MSBuild Projects="PostBuild.targets" />
    </Target>
    

    See also:

    • Extending the solution build
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several web application projects in one solution. When I start debugging one
I have a Visual Studio (2008) solution consisting of several projects, not all in
We have a web solution with mixed C# and VB.NET (3.5) projects (note: several
I have a solution with several projects. One of them is a setup project.
I have a solution with several projects, where the startup project has a post-build
I have a solution containing several projects that have migrated from VS 2003, 2005,
I have a Solution with several projects in it, including two asp.net mvc projects
I have several projects and a website in a large asp.net solution. In some
I have a Visual Studio solution that comprises of several projects and are separated
I have a solution with several Silverlight Class Libraries and a Silverlight Application in

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.