The question came up from several attendees at my MSDN Webcast on ClickOnce yesterday:
“Can I launch a XXX application using ClickOnce?” (fill in XXX with VB6, MFC, etc. – non-.NET applications)
The answer is yes, you will just have to employ a little trick.
What you need is a simple little launcher application that IS a Windows .NET application. So do the following:
Create a new Windows Application project with VS 2005.
Delete the Form1 from the project.
Add the unmanaged EXE and any supporting files to the VS 2005 project, which makes them part of this application from a ClickOnce perspective. As a result, they will get deployed with this application to its cache folder and can be executed by this launcher app.
Edit the Program.cs file Main method and delete the current method body (which launches the application and the form) and replace it with code to launch the unmanaged executable. This just requires a single line of code: Process.Start(“MyUnamangedApp.exe”);
Note: You will need to give the launcher app full trust in the ClickOnce security settings.
Note2: If the unmanaged app relies on ActiveX or COM objects, those need to be added to the project as well, and you will need to add a reference to the COM DLL’s to the project to get their reg-free COM information added to the manifest. See this article for more details.