Note that there are some explanatory texts on larger screens.

plurals
  1. POClickOnce application does not start through Process.Start("x.abc") with *.abc associated to the ClickOnce application
    primarykey
    data
    text
    <p>I have successfully developed and deployed a ClickOnce application which registers an associated file extension, for instance <code>*.abc</code>. When I click on a file named <code>x.abc</code> or if I type <code>x.abc</code> from the command prompt, the ClickOnce application starts, and I can retrieve the file through the dedicated API. I can also launch the application programmatically with the following code:</p> <pre><code>System.Diagnostics.Process.Start ("x.abc"); </code></pre> <p>Everything works fine on my Windows&nbsp;Vista 64&nbsp;bit box.</p> <p>However, if I try to do exactly the same thing on a Windows 7 (also 64&nbsp;bit ), I have a very strange problem. Here is what I observe:</p> <ol> <li>Manual start of <code>x.abc</code> by double-clicking it from the Explorer works.</li> <li>Manual start of <code>x.abc</code> from the command prompt works.</li> <li><code>Process.Start("x.abc")</code> does not start the application; however, the process object returned shows that there was not error and that the ClickOnce application somehow exited immediately. But even a <code>Trace</code> at the very beginning of the ClickOnce application is never reached.</li> <li>Stranger yet, <code>Process.Start("x.bat")</code> with a file <code>x.bat</code> containing the single line <code>x.abc</code> does not start the ClickOnce application either! Same <code>x.bat</code> started from the Explorer works (of course).</li> </ol> <p>Trying to analyse what happens with <code>ProcMon</code> was not very helpful, as the ClickOnce process of launching an application is very difficult to follow, from my point of view. I observe <code>rundll32</code> getting to work, but no evidence of any failure.</p> <p>The program which is doing the <code>Process.Start</code> is a full trust console application with really nothing fancy.</p> <p>I can't see what changed with respect to how ClickOnce applications are handled on Windows 7 and why <code>Process.Start</code> would not do exactly the same as launching the file from Explorer. It's worth to mention that using more advanced versions of the <code>Start</code> method with <code>ProcessStartInfo</code> and setting <code>UseShellExecute</code> to <code>true</code> did not help either.</p> <p>Starting <code>cmd</code> with <code>Process.Start</code> and then trying to launch <code>x.abc</code> shows exactly the same problem. If I compare the environment settings with a <code>cmd</code> started manually, I see differences in how <code>ProgramFiles</code> is defined (the first one points to <code>C:\Program Files (x86)</code> whereas the second points to <code>C:\Program Files</code>). The applications started from my .NET application are started on the 32-bit emulation layer (SysWoW64).</p> <p>I was able to reproduce the launch failure of <code>x.abc</code> by starting a 32-bit version of the command prompt (that is, <code>%windir%\SysWoW64\cmd.exe</code>) and then typing <code>x.abc</code> at the prompt. I have also found an ugly workaround, which is to start a 64-bit command prompt from the 32-bit environment by launching <code>%windir%\Sysnative\cmd.exe /C x.abc</code> instead of <code>x.abc</code>.</p> <p>But I'd rather use a clean way of doing it (or have a Microsoft representative tell me that this is indeed an issue with Windows 7 and/or ClickOncce and that it will be fixed soon).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload