ClickOnce Deployment for Unmanaged Code (C++, VB6, etc)

Monday, August 25, 2008 10:53:30 PM (Eastern Standard Time, UTC-05:00)

ClickOnce is a great deployment model for many Windows applications built with the .NET Framework. Too bad it isn't supported for C++, VB 6, or other technologies. Or is it...

Surprisingly, you can deploy your unmanaged apps with ClickOnce. You just need a tiny .NET app to get it started.

Here's how it works:

  1. Take your existing C++ project.

  2. Add to the solution a .NET console application.

  3. Change the project settings on the console application to "Windows Application".

  4. Write the following code for your Main method of your .NET launcher application:
    static void Main(string[] args)
    {
        try
        {
            Process.Start( "TheRealApp.exe" );
        }
        catch ( Exception x )
        {
            string msg = "Error launch application:\n\n" + x;
            string cap = "Error Launching Application";
            MessageBox.Show( msg, cap, MessageBoxButtons.OK, MessageBoxIcon.Error );
        }
    }
    
  5. Set the build path of your C++ app to be in the main folder for your .NET application.

  6. Add the C++ app and its libraries (if any) as existing items in the .NET app.

  7. Change the build action to "Always Copy" as shown here:




  8. Then you publish your .NET application and when it runs, TADA!, the C++ app is deployed, versioned, and kept up to date as well.



If you want to try it yourself, you can run this sample application here:

   Run Michael's Useless C++ App via ClickOnce...

You can also download the source.



ThreadPool Bug in .NET 2.0 SP1 is Fixed!

Wednesday, August 20, 2008 11:18:02 AM (Eastern Standard Time, UTC-05:00)

I'm glad to confirm that the ThreadPool bug introduced in .NET 3.5 has been fixed in SP1 for .NET 3.5.

For more background information, look at these posts.

  1. .NET 3.5 Brings Breaking Changes to ThreadPool
  2. Breaking Changes in the ThreadPool: The Movie
  3. Follow up on .NET 2.0 SP1 ThreadPool Bug
  4. More on the ThreadPool Bug in .NET 2.0 SP1

Now go forth, and create some threads!