Visual Studio post build events stuck waiting for executable to finish before running app in debug mode

Viewed 8362

Part of the post build on my project is the execution of a program I wrote for testing the main application. Unfortunately, the post build process in visual studio locks up waiting for the executable to exit. So, i'm stuck closing my test program in order to have the post build process complete and my application run. How do I change this so VS does not wait for the program to return before launching? Thanks.

7 Answers

Wow, seems VS is really stubborn about this.

You can use this little tool that can launch apps without showing cmd windows (among other things). In your post build event:

c:\path\to\cmdow /run app.exe

If you utilize cruise control for your builds, you could place this in the publishers section which allows the build to finish before running the publisher tasks.

Additionally a custom msbuild task is quite trivial to build, if you know how to spin off a process in .net then it's really simple to do in msbuild. To do this you could edit your .csproj file or your .proj build script to use that custom task.

using System;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;

namespace MyTasks
{
public class SimpleTask : Task
{
    public override bool Execute()
    {
//something involving Process.Start
        return true;
    }
}
}

Then in your build script or csproj file you add the using for the task you created and call it.

Related