<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: ClickOnce Run at Startup</title>
	<atom:link href="http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/feed/" rel="self" type="application/rss+xml" />
	<link>http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/</link>
	<description></description>
	<lastBuildDate>Sat, 19 May 2012 20:42:47 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Jochen Wezel</title>
		<link>http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/comment-page-1/#comment-343156</link>
		<dc:creator>Jochen Wezel</dc:creator>
		<pubDate>Wed, 22 Feb 2012 09:45:50 +0000</pubDate>
		<guid isPermaLink="false">http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/#comment-343156</guid>
		<description>As we all know now, it&#039;s not a good idea to use the URL link in the start up. But for completeness of this article, here one more reason:

If a user switches his default browser from IE to Firefox, Firefox is NOT able to correctly launch the URL (it opens a dialog wether to download or to cancel the file)</description>
		<content:encoded><![CDATA[<p>As we all know now, it&#8217;s not a good idea to use the URL link in the start up. But for completeness of this article, here one more reason:</p>
<p>If a user switches his default browser from IE to Firefox, Firefox is NOT able to correctly launch the URL (it opens a dialog wether to download or to cancel the file)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joseph Obi</title>
		<link>http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/comment-page-1/#comment-320125</link>
		<dc:creator>Joseph Obi</dc:creator>
		<pubDate>Wed, 04 Jan 2012 20:34:20 +0000</pubDate>
		<guid isPermaLink="false">http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/#comment-320125</guid>
		<description>Today, I went to the beach with my kids. I found a sea shell and gave it to my 4 year old daughter and said &quot;You can hear the ocean if you put this to your ear.&quot; She placed the shell to her ear and screamed. There was a hermit crab inside and it pinched her ear. She never wants to go back! LoL I know this is entirely off topic but I had to tell someone!</description>
		<content:encoded><![CDATA[<p>Today, I went to the beach with my kids. I found a sea shell and gave it to my 4 year old daughter and said &#8220;You can hear the ocean if you put this to your ear.&#8221; She placed the shell to her ear and screamed. There was a hermit crab inside and it pinched her ear. She never wants to go back! LoL I know this is entirely off topic but I had to tell someone!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: VILIC</title>
		<link>http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/comment-page-1/#comment-309794</link>
		<dc:creator>VILIC</dc:creator>
		<pubDate>Mon, 19 Dec 2011 16:49:28 +0000</pubDate>
		<guid isPermaLink="false">http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/#comment-309794</guid>
		<description>I am stick with this problem these days, but I think a associated file may help.
I was thinking about create a file association after I had noticed that VS 2010 provide this option. Maybe, maybe.</description>
		<content:encoded><![CDATA[<p>I am stick with this problem these days, but I think a associated file may help.<br />
I was thinking about create a file association after I had noticed that VS 2010 provide this option. Maybe, maybe.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: caralluma reviews</title>
		<link>http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/comment-page-1/#comment-285955</link>
		<dc:creator>caralluma reviews</dc:creator>
		<pubDate>Thu, 17 Nov 2011 03:36:51 +0000</pubDate>
		<guid isPermaLink="false">http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/#comment-285955</guid>
		<description>Is there a website that makes it easy to follow blogs and podcasts? I don&#039;t have an iPod, does that matter?.</description>
		<content:encoded><![CDATA[<p>Is there a website that makes it easy to follow blogs and podcasts? I don&#8217;t have an iPod, does that matter?.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jordan H.</title>
		<link>http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/comment-page-1/#comment-260732</link>
		<dc:creator>Jordan H.</dc:creator>
		<pubDate>Fri, 23 Sep 2011 08:19:08 +0000</pubDate>
		<guid isPermaLink="false">http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/#comment-260732</guid>
		<description>Just wrote a batch script that works by means of solution 2 but is cleaner (minimizes internet explorer so its never seen) and also handles the possibility of clearing the batch file from the startup menu in the first reboot after the click once app is uninstalled.

The .bat code:



IF EXIST &quot;%userprofile%\desktop\&lt;b&gt;Application Name&lt;/b&gt;.appref-ms&quot; (
start /min iexplore &quot;&lt;b&gt;URL shortcut file to update location&lt;/b&gt;&quot;
) ELSE (del %0)



This code checks first on the desktop for application being present but it can be pointed to the AppData directory if desktop icon is not needed.

It then improves upon the internet explorer cleanliness by loading the application through IE in minimized mode.

It loads up and closes IE out before the user has a chance to even open IE. Not perfect but the best I&#039;ve found so far.

Finally, I figured out the removal of the batch script from startup after a uninstalling the ClickOnce App.

With an Else statement if file does not exist(which it won&#039;t upon the uninstall), the function 

del %0

deletes the batch file itself and so clears the startup menu of this batch file.

All that is required is a reboot following the uninstall and the batch file will delete itself.

All I have to do to make this work is add this batch file to resources in my application(startup.bat or some such file name) and use File.WriteAllText to write it to the start up menu upon loading the app. Every time the application loads, I can check that this startup batch file is still present and rewrite it there if needed.

Hope this helps and let me know your feedback!</description>
		<content:encoded><![CDATA[<p>Just wrote a batch script that works by means of solution 2 but is cleaner (minimizes internet explorer so its never seen) and also handles the possibility of clearing the batch file from the startup menu in the first reboot after the click once app is uninstalled.</p>
<p>The .bat code:</p>
<p>IF EXIST &#8220;%userprofile%\desktop\<b>Application Name</b>.appref-ms&#8221; (<br />
start /min iexplore &#8220;<b>URL shortcut file to update location</b>&#8221;<br />
) ELSE (del %0)</p>
<p>This code checks first on the desktop for application being present but it can be pointed to the AppData directory if desktop icon is not needed.</p>
<p>It then improves upon the internet explorer cleanliness by loading the application through IE in minimized mode.</p>
<p>It loads up and closes IE out before the user has a chance to even open IE. Not perfect but the best I&#8217;ve found so far.</p>
<p>Finally, I figured out the removal of the batch script from startup after a uninstalling the ClickOnce App.</p>
<p>With an Else statement if file does not exist(which it won&#8217;t upon the uninstall), the function </p>
<p>del %0</p>
<p>deletes the batch file itself and so clears the startup menu of this batch file.</p>
<p>All that is required is a reboot following the uninstall and the batch file will delete itself.</p>
<p>All I have to do to make this work is add this batch file to resources in my application(startup.bat or some such file name) and use File.WriteAllText to write it to the start up menu upon loading the app. Every time the application loads, I can check that this startup batch file is still present and rewrite it there if needed.</p>
<p>Hope this helps and let me know your feedback!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ranjan</title>
		<link>http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/comment-page-1/#comment-255766</link>
		<dc:creator>Ranjan</dc:creator>
		<pubDate>Thu, 25 Aug 2011 04:40:16 +0000</pubDate>
		<guid isPermaLink="false">http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/#comment-255766</guid>
		<description>I want to launch an application from start Menu. Pls tell me what is the syntax for this.

Next thing is, after the application(small window) is launched, it has some checkbox, drop down list, textbox.I want to set some value on it, How to do.

Thanks a Lot in advance.</description>
		<content:encoded><![CDATA[<p>I want to launch an application from start Menu. Pls tell me what is the syntax for this.</p>
<p>Next thing is, after the application(small window) is launched, it has some checkbox, drop down list, textbox.I want to set some value on it, How to do.</p>
<p>Thanks a Lot in advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rolf</title>
		<link>http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/comment-page-1/#comment-250513</link>
		<dc:creator>Rolf</dc:creator>
		<pubDate>Fri, 15 Jul 2011 17:13:27 +0000</pubDate>
		<guid isPermaLink="false">http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/#comment-250513</guid>
		<description>Hi Ben,

I&#039;m researching an idea that also requires clickonce. It should run on startup and be able to uninstall itself cleanly. I was thinking if it would be possible to install another executable (possibly deployed as a prerequisite) that runs at startup and would be responsible for locating and starting the clickonce app, but wouldn&#039;t be a clickonce app itself.

It could uninstall itself when the clickonce app is no longer installed or, in my case, the clickonce app could uninstall it before it uninstalls itself.

I read that with script installers like NSIS it&#039;s possible to do installs without user interaction, so that might still make it a clickonce experience, even though 2 apps are installed. It sounds a bit like a security issue to me so it might not be possible to install such an executable at all with clickonce, but perhaps it isn&#039;t..

What&#039;s your opinion, would it work in one way or another?</description>
		<content:encoded><![CDATA[<p>Hi Ben,</p>
<p>I&#8217;m researching an idea that also requires clickonce. It should run on startup and be able to uninstall itself cleanly. I was thinking if it would be possible to install another executable (possibly deployed as a prerequisite) that runs at startup and would be responsible for locating and starting the clickonce app, but wouldn&#8217;t be a clickonce app itself.</p>
<p>It could uninstall itself when the clickonce app is no longer installed or, in my case, the clickonce app could uninstall it before it uninstalls itself.</p>
<p>I read that with script installers like NSIS it&#8217;s possible to do installs without user interaction, so that might still make it a clickonce experience, even though 2 apps are installed. It sounds a bit like a security issue to me so it might not be possible to install such an executable at all with clickonce, but perhaps it isn&#8217;t..</p>
<p>What&#8217;s your opinion, would it work in one way or another?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tim</title>
		<link>http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/comment-page-1/#comment-243414</link>
		<dc:creator>tim</dc:creator>
		<pubDate>Sat, 07 May 2011 02:36:31 +0000</pubDate>
		<guid isPermaLink="false">http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/#comment-243414</guid>
		<description>It&#039;s great to come back to this issue after 2 years and see so much good stuff.  Thanks everyone for contributing!  (This time I was trying to look for how to get the published name - which in my case is different from the assembly name.)</description>
		<content:encoded><![CDATA[<p>It&#8217;s great to come back to this issue after 2 years and see so much good stuff.  Thanks everyone for contributing!  (This time I was trying to look for how to get the published name &#8211; which in my case is different from the assembly name.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roy</title>
		<link>http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/comment-page-1/#comment-242536</link>
		<dc:creator>Roy</dc:creator>
		<pubDate>Fri, 29 Apr 2011 15:46:25 +0000</pubDate>
		<guid isPermaLink="false">http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/#comment-242536</guid>
		<description>Just thought I&#039;d throw this out there to the interwebs incase someone else googles this. Copies the appref-ms to all users startup. MUST BE ADMIN after that gravy for other users. It works on XP and I&#039;ll probly test something similar out on Win7 a bit later as for Vista, L to the O to the L, why bother.

Dim userName As String
userName = Environment.UserName

        If My.Computer.FileSystem.FileExists(&quot;C:\Documents and Settings\All Users\Start Menu\Programs\Startup\YOURAPP.appref-ms&quot;) Then

Else

            My.Computer.FileSystem.CopyFile(&quot;C:\Documents and Settings\&quot; &amp; userName &amp; &quot;\Start Menu\Programs\YOURAPP\YOURAPP.appref-ms&quot;, &quot;C:\Documents and Settings\All Users\Start Menu\Programs\Startup\YOURAPP.appref-ms&quot;, overwrite:=True)

        End If</description>
		<content:encoded><![CDATA[<p>Just thought I&#8217;d throw this out there to the interwebs incase someone else googles this. Copies the appref-ms to all users startup. MUST BE ADMIN after that gravy for other users. It works on XP and I&#8217;ll probly test something similar out on Win7 a bit later as for Vista, L to the O to the L, why bother.</p>
<p>Dim userName As String<br />
userName = Environment.UserName</p>
<p>        If My.Computer.FileSystem.FileExists(&#8220;C:\Documents and Settings\All Users\Start Menu\Programs\Startup\YOURAPP.appref-ms&#8221;) Then</p>
<p>Else</p>
<p>            My.Computer.FileSystem.CopyFile(&#8220;C:\Documents and Settings\&#8221; &amp; userName &amp; &#8220;\Start Menu\Programs\YOURAPP\YOURAPP.appref-ms&#8221;, &#8220;C:\Documents and Settings\All Users\Start Menu\Programs\Startup\YOURAPP.appref-ms&#8221;, overwrite:=True)</p>
<p>        End If</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy-HR</title>
		<link>http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/comment-page-1/#comment-240283</link>
		<dc:creator>Andy-HR</dc:creator>
		<pubDate>Tue, 05 Apr 2011 22:35:40 +0000</pubDate>
		<guid isPermaLink="false">http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/#comment-240283</guid>
		<description>In Publish Options of project (your first picture)
you can write :
Publisher name : Startup
Suite name : --leave blank--

Product name : Your product name.

This will put ClickOnce program link directly to startup :)</description>
		<content:encoded><![CDATA[<p>In Publish Options of project (your first picture)<br />
you can write :<br />
Publisher name : Startup<br />
Suite name : &#8211;leave blank&#8211;</p>
<p>Product name : Your product name.</p>
<p>This will put ClickOnce program link directly to startup <img src='http://johnnycoder.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stella Hartley</title>
		<link>http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/comment-page-1/#comment-232283</link>
		<dc:creator>Stella Hartley</dc:creator>
		<pubDate>Mon, 17 Jan 2011 21:00:35 +0000</pubDate>
		<guid isPermaLink="false">http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/#comment-232283</guid>
		<description>Great blog post, I have been looking for something like that..

 Rebekah

&lt;a href=&quot;http://www.yutube.si&quot; rel=&quot;nofollow&quot;&gt;yutube&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>Great blog post, I have been looking for something like that..</p>
<p> Rebekah</p>
<p><a href="http://www.yutube.si" rel="nofollow">yutube</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Deo</title>
		<link>http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/comment-page-1/#comment-220317</link>
		<dc:creator>Deo</dc:creator>
		<pubDate>Thu, 17 Jun 2010 02:28:23 +0000</pubDate>
		<guid isPermaLink="false">http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/#comment-220317</guid>
		<description>I used the batch file and the application start up fine. I am using it an terminal server. the problem is if there is an update on the application, it log off and it does not update the application.</description>
		<content:encoded><![CDATA[<p>I used the batch file and the application start up fine. I am using it an terminal server. the problem is if there is an update on the application, it log off and it does not update the application.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mike</title>
		<link>http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/comment-page-1/#comment-212698</link>
		<dc:creator>mike</dc:creator>
		<pubDate>Fri, 27 Nov 2009 04:39:06 +0000</pubDate>
		<guid isPermaLink="false">http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/#comment-212698</guid>
		<description>suggested workaround
click once can create desktop shortcut on update

when onload copy the new desktop shortcut to the applications executing assembly folder then delete desktop one if necessary

create registry run key with value set to the shortcut path now residing in the executing assembly
ie my_new_key c:\users\what-en-what\appref-ms

on restart isnetworkdeployed = true

hope this helps</description>
		<content:encoded><![CDATA[<p>suggested workaround<br />
click once can create desktop shortcut on update</p>
<p>when onload copy the new desktop shortcut to the applications executing assembly folder then delete desktop one if necessary</p>
<p>create registry run key with value set to the shortcut path now residing in the executing assembly<br />
ie my_new_key c:\users\what-en-what\appref-ms</p>
<p>on restart isnetworkdeployed = true</p>
<p>hope this helps</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ernest Cook</title>
		<link>http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/comment-page-1/#comment-212251</link>
		<dc:creator>Ernest Cook</dc:creator>
		<pubDate>Sun, 15 Nov 2009 14:09:07 +0000</pubDate>
		<guid isPermaLink="false">http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/#comment-212251</guid>
		<description>I have the uninstall issue but for a different reason...

I am publishing a new version of my app that specifies a specific CPU in order to support 64 bit systems. This &quot;breaks&quot; the clickonce automatic update. My workaround is to provide users the URL to launch the latest version and then, since it will have created a 2nd application, I want to programaitically uninstall the old version.

Any update on solving the uninstall issue?</description>
		<content:encoded><![CDATA[<p>I have the uninstall issue but for a different reason&#8230;</p>
<p>I am publishing a new version of my app that specifies a specific CPU in order to support 64 bit systems. This &#8220;breaks&#8221; the clickonce automatic update. My workaround is to provide users the URL to launch the latest version and then, since it will have created a 2nd application, I want to programaitically uninstall the old version.</p>
<p>Any update on solving the uninstall issue?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Logan Waggoner</title>
		<link>http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/comment-page-1/#comment-210904</link>
		<dc:creator>Logan Waggoner</dc:creator>
		<pubDate>Tue, 13 Oct 2009 19:35:09 +0000</pubDate>
		<guid isPermaLink="false">http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/#comment-210904</guid>
		<description>Here is a simplified version with a few bug fixes from above, only think that would make this a little better would be pulling the app info and publisher info, this just uses the Assembly info.
        
Dim key As RegistryKey = Registry.CurrentUser.OpenSubKey(&quot;Software&quot;)
        key = key.OpenSubKey(&quot;Microsoft&quot;)
        key = key.OpenSubKey(&quot;Windows&quot;)
        key = key.OpenSubKey(&quot;CurrentVersion&quot;)
        key = key.OpenSubKey(&quot;Run&quot;, True)
        Dim rootdir = &quot;&quot;
        If System.IO.Directory.Exists(&quot;C:\Users&quot;) Then rootdir = &quot;C:\Users\&quot; Else rootdir = &quot;C:\Documents and Settings\&quot;

        key.SetValue(&quot;QBCommenter&quot;, rootdir + Environment.UserName + &quot;\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\&quot; + My.Application.Info.CompanyName + &quot;\&quot; + My.Application.Info.ProductName + &quot;.appref-ms&quot;)</description>
		<content:encoded><![CDATA[<p>Here is a simplified version with a few bug fixes from above, only think that would make this a little better would be pulling the app info and publisher info, this just uses the Assembly info.</p>
<p>Dim key As RegistryKey = Registry.CurrentUser.OpenSubKey(&#8220;Software&#8221;)<br />
        key = key.OpenSubKey(&#8220;Microsoft&#8221;)<br />
        key = key.OpenSubKey(&#8220;Windows&#8221;)<br />
        key = key.OpenSubKey(&#8220;CurrentVersion&#8221;)<br />
        key = key.OpenSubKey(&#8220;Run&#8221;, True)<br />
        Dim rootdir = &#8220;&#8221;<br />
        If System.IO.Directory.Exists(&#8220;C:\Users&#8221;) Then rootdir = &#8220;C:\Users\&#8221; Else rootdir = &#8220;C:\Documents and Settings\&#8221;</p>
<p>        key.SetValue(&#8220;QBCommenter&#8221;, rootdir + Environment.UserName + &#8220;\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\&#8221; + My.Application.Info.CompanyName + &#8220;\&#8221; + My.Application.Info.ProductName + &#8220;.appref-ms&#8221;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Logan Waggoner</title>
		<link>http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/comment-page-1/#comment-210881</link>
		<dc:creator>Logan Waggoner</dc:creator>
		<pubDate>Tue, 13 Oct 2009 01:53:27 +0000</pubDate>
		<guid isPermaLink="false">http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/#comment-210881</guid>
		<description>Here is what I&#039;m using, I&#039;m pretty sure it is going to work but I haven&#039;t fully tested it. I&#039;ve got a lot more hard coding in here than you would want but that can be gathered easily if necessary. (Publisher name, resultant executable, name you can choose for the key can also be derived from the assembly) etc...

You need to import Microsoft.Win32

Dim key As RegistryKey = Registry.CurrentUser.OpenSubKey(&quot;Software&quot;)
        key = key.OpenSubKey(&quot;Microsoft&quot;)
        key = key.OpenSubKey(&quot;Windows&quot;)
        key = key.OpenSubKey(&quot;CurrentVersion&quot;)
        key = key.OpenSubKey(&quot;Run&quot;, True)
        If key.GetValue(&quot;YOUR_KEY_NAME&quot;) Is Nothing Then

            If System.IO.Directory.Exists(&quot;C:\Users&quot;) Then
                key.SetValue(&quot;YOUR_KEY_NAME&quot;, &quot;C:\Users\&quot; + Environment.UserName + &quot;\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\&quot;+&quot;PUBLISHER_NAME_HERE&quot; + &quot;\&quot; + &quot;YOUR_EXECUTABLE&quot;)
            Else
key.SetValue(&quot;YOUR_KEY_NAME&quot;, &quot;C:\Documents and Settings\&quot; + Environment.UserName + &quot;\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\&quot;+&quot;PUBLISHER_NAME_HERE&quot; + &quot;\&quot; + &quot;YOUR_EXECUTABLE&quot;)</description>
		<content:encoded><![CDATA[<p>Here is what I&#8217;m using, I&#8217;m pretty sure it is going to work but I haven&#8217;t fully tested it. I&#8217;ve got a lot more hard coding in here than you would want but that can be gathered easily if necessary. (Publisher name, resultant executable, name you can choose for the key can also be derived from the assembly) etc&#8230;</p>
<p>You need to import Microsoft.Win32</p>
<p>Dim key As RegistryKey = Registry.CurrentUser.OpenSubKey(&#8220;Software&#8221;)<br />
        key = key.OpenSubKey(&#8220;Microsoft&#8221;)<br />
        key = key.OpenSubKey(&#8220;Windows&#8221;)<br />
        key = key.OpenSubKey(&#8220;CurrentVersion&#8221;)<br />
        key = key.OpenSubKey(&#8220;Run&#8221;, True)<br />
        If key.GetValue(&#8220;YOUR_KEY_NAME&#8221;) Is Nothing Then</p>
<p>            If System.IO.Directory.Exists(&#8220;C:\Users&#8221;) Then<br />
                key.SetValue(&#8220;YOUR_KEY_NAME&#8221;, &#8220;C:\Users\&#8221; + Environment.UserName + &#8220;\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\&#8221;+&#8221;PUBLISHER_NAME_HERE&#8221; + &#8220;\&#8221; + &#8220;YOUR_EXECUTABLE&#8221;)<br />
            Else<br />
key.SetValue(&#8220;YOUR_KEY_NAME&#8221;, &#8220;C:\Documents and Settings\&#8221; + Environment.UserName + &#8220;\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\&#8221;+&#8221;PUBLISHER_NAME_HERE&#8221; + &#8220;\&#8221; + &#8220;YOUR_EXECUTABLE&#8221;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: thijs</title>
		<link>http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/comment-page-1/#comment-207690</link>
		<dc:creator>thijs</dc:creator>
		<pubDate>Wed, 26 Aug 2009 11:41:37 +0000</pubDate>
		<guid isPermaLink="false">http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/#comment-207690</guid>
		<description>I used the executable of my application to launch itself via the appref-ms shortcut. This doesn&#039;t require a browser and works fine on vista. I&#039;ll post a piece on this one on my blog. I didn&#039;t solve the uninstall issue yet.</description>
		<content:encoded><![CDATA[<p>I used the executable of my application to launch itself via the appref-ms shortcut. This doesn&#8217;t require a browser and works fine on vista. I&#8217;ll post a piece on this one on my blog. I didn&#8217;t solve the uninstall issue yet.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: thijs</title>
		<link>http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/comment-page-1/#comment-207421</link>
		<dc:creator>thijs</dc:creator>
		<pubDate>Fri, 21 Aug 2009 07:41:15 +0000</pubDate>
		<guid isPermaLink="false">http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/#comment-207421</guid>
		<description>@Ben Did you try out the batch file solution? Did it work?</description>
		<content:encoded><![CDATA[<p>@Ben Did you try out the batch file solution? Did it work?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Griswold</title>
		<link>http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/comment-page-1/#comment-202271</link>
		<dc:creator>Ben Griswold</dc:creator>
		<pubDate>Tue, 30 Jun 2009 16:02:28 +0000</pubDate>
		<guid isPermaLink="false">http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/#comment-202271</guid>
		<description>@Mark Fulton - That&#039;s an interesting idea. So, I would have my ClickOnce application create a bat file with the appropriate launch information (appref-ms reference) rather than including the shortcut to the appref-ms file in the Startup folder itself. I&#039;ll give it a shot.

@Dirtel Minder - Unfortunately that approach doesn&#039;t work on Vista for ClickOnce hosted applications. It doesn&#039;t work, however, if the application were running as a non-ClickOnce deployed application.</description>
		<content:encoded><![CDATA[<p>@Mark Fulton &#8211; That&#8217;s an interesting idea. So, I would have my ClickOnce application create a bat file with the appropriate launch information (appref-ms reference) rather than including the shortcut to the appref-ms file in the Startup folder itself. I&#8217;ll give it a shot.</p>
<p>@Dirtel Minder &#8211; Unfortunately that approach doesn&#8217;t work on Vista for ClickOnce hosted applications. It doesn&#8217;t work, however, if the application were running as a non-ClickOnce deployed application.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dirtel Minder</title>
		<link>http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/comment-page-1/#comment-202259</link>
		<dc:creator>Dirtel Minder</dc:creator>
		<pubDate>Tue, 30 Jun 2009 13:41:16 +0000</pubDate>
		<guid isPermaLink="false">http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/#comment-202259</guid>
		<description>Er.. what about simply updating the registry to put the path of the executing assembly in HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run?

This will work on Vista and XP. When the app updates you can simply update the registry with the new exe path (since it changed on every deployment).</description>
		<content:encoded><![CDATA[<p>Er.. what about simply updating the registry to put the path of the executing assembly in HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run?</p>
<p>This will work on Vista and XP. When the app updates you can simply update the registry with the new exe path (since it changed on every deployment).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Fulton</title>
		<link>http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/comment-page-1/#comment-200248</link>
		<dc:creator>Mark Fulton</dc:creator>
		<pubDate>Wed, 17 Jun 2009 19:06:16 +0000</pubDate>
		<guid isPermaLink="false">http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/#comment-200248</guid>
		<description>Why don&#039;t you use a batch file? For example, a file named &quot;AutoStartClickOnceApp.bat&quot; would contain the following single line of text: &quot;C:\Documents and Settings\[User Name]\Start Menu\Programs\[ClickOnce Application Name].appref-ms&quot;

It should be that simple! Sure, you&#039;ll get a Command Prompt window that will appear for a brief moment but that is typical of MS Windows (i.e. logging into some domain).

I hope this helps. Good luck!</description>
		<content:encoded><![CDATA[<p>Why don&#8217;t you use a batch file? For example, a file named &#8220;AutoStartClickOnceApp.bat&#8221; would contain the following single line of text: &#8220;C:\Documents and Settings\[User Name]\Start Menu\Programs\[ClickOnce Application Name].appref-ms&#8221;</p>
<p>It should be that simple! Sure, you&#8217;ll get a Command Prompt window that will appear for a brief moment but that is typical of MS Windows (i.e. logging into some domain).</p>
<p>I hope this helps. Good luck!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Griswold</title>
		<link>http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/comment-page-1/#comment-195312</link>
		<dc:creator>Ben Griswold</dc:creator>
		<pubDate>Tue, 12 May 2009 15:29:37 +0000</pubDate>
		<guid isPermaLink="false">http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/#comment-195312</guid>
		<description>@Dipesh A. - That&#039;s a valid point regarding URL Shortcut solution for Vista. Assuming the user has an Internet connection, it will work just fine, but, you&#039;re right, the solution doesn&#039;t gracefully handle itself in the case of the user who is working offline.  Thanks for the comment.</description>
		<content:encoded><![CDATA[<p>@Dipesh A. &#8211; That&#8217;s a valid point regarding URL Shortcut solution for Vista. Assuming the user has an Internet connection, it will work just fine, but, you&#8217;re right, the solution doesn&#8217;t gracefully handle itself in the case of the user who is working offline.  Thanks for the comment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dipesh A.</title>
		<link>http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/comment-page-1/#comment-195244</link>
		<dc:creator>Dipesh A.</dc:creator>
		<pubDate>Tue, 12 May 2009 05:39:37 +0000</pubDate>
		<guid isPermaLink="false">http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/#comment-195244</guid>
		<description>Solution is may not be as reliable in Vista if you look closer..

If the user is offline when logging on to windows, the blank IE windows opens (is it actually trying to connect to the server specified in the short cut) and &quot;Page cannot be displayed&quot; pops up. Everything stops here.

This is not reliable because majority of the users wont be connected to the internet when they are logging on to windows unless they are on a network.</description>
		<content:encoded><![CDATA[<p>Solution is may not be as reliable in Vista if you look closer..</p>
<p>If the user is offline when logging on to windows, the blank IE windows opens (is it actually trying to connect to the server specified in the short cut) and &#8220;Page cannot be displayed&#8221; pops up. Everything stops here.</p>
<p>This is not reliable because majority of the users wont be connected to the internet when they are logging on to windows unless they are on a network.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Griswold</title>
		<link>http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/comment-page-1/#comment-187427</link>
		<dc:creator>Ben Griswold</dc:creator>
		<pubDate>Thu, 09 Apr 2009 18:05:48 +0000</pubDate>
		<guid isPermaLink="false">http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/#comment-187427</guid>
		<description>@Andy - Thanks for your comments and thanks for sharing your code. This issue (particularly the common misunderstanding of where the start menu information is derived) has been driving me nuts for weeks. I can&#039;t tell you how excited I am that you know how to get at the &quot;real&quot; ClickOnce publisher and product values and I can hardly wait to play around with your code tonight.  Thanks for the contribution!</description>
		<content:encoded><![CDATA[<p>@Andy &#8211; Thanks for your comments and thanks for sharing your code. This issue (particularly the common misunderstanding of where the start menu information is derived) has been driving me nuts for weeks. I can&#8217;t tell you how excited I am that you know how to get at the &#8220;real&#8221; ClickOnce publisher and product values and I can hardly wait to play around with your code tonight.  Thanks for the contribution!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy Copson</title>
		<link>http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/comment-page-1/#comment-187420</link>
		<dc:creator>Andy Copson</dc:creator>
		<pubDate>Thu, 09 Apr 2009 17:33:37 +0000</pubDate>
		<guid isPermaLink="false">http://johnnycoder.com/blog/2009/02/24/clickonce-run-at-startup/#comment-187420</guid>
		<description>Hi Ben,

Here&#039;s the code. You&#039;ll notice the GetDeploymentDescription() method is asynchronous so you may want to wire up an event to fire when the information is loaded. In my case the code is contained within a class that has a string field &#039;startMenuCommand&#039; which is set when the deployment information has been loaded.

Hope this works ok for you.

Cheers,

Andy

// utility class to extract publisher/suiteName/Product

    public class DeploymentDescription
    {
        private const string descriptionElement = &quot;description&quot;;
        private const string publisherAttribute = &quot;publisher&quot;;
        private const string suiteNameAttribute = &quot;suiteName&quot;;
        private const string productAttribute = &quot;product&quot;;
        private string publisher;
        private string suiteName;
        private string product;

        public DeploymentDescription(XmlReader xmlDeploymentManifest)
        {
            ExtractDescriptions(xmlDeploymentManifest);
        }

        private void ExtractDescriptions(XmlReader appManifest)
        {
            while (appManifest.Read())
            {
                if (appManifest.NodeType == XmlNodeType.Element)
                {
                    if (appManifest.Name == descriptionElement)
                    {
                        appManifest.MoveToFirstAttribute();
                        do
                        {
                            if (appManifest.Name.Contains(publisherAttribute))
                                publisher = appManifest.Value;
                            else if (appManifest.Name.Contains(suiteNameAttribute))
                                suiteName = appManifest.Value;
                            else if (appManifest.Name.Contains(productAttribute))
                                product = appManifest.Value;
                        } while (appManifest.MoveToNextAttribute());
                        return;
                    }
                }
            }
        }

        public string Publisher
        {
            get { return publisher; }
        }

        public string SuiteName
        {
            get { return suiteName; }
        }

        public string Product
        {
            get { return product; }
        }
    }
	
	// utility class to build executable command
	
	public class StartMenuCommandBuilder
    {
        private readonly string command;

        public StartMenuCommandBuilder(DeploymentDescription deploymentDescription)
        {
            if (deploymentDescription == null) throw new ArgumentNullException(&quot;deploymentDescription&quot;);
            command = Environment.GetFolderPath(Environment.SpecialFolder.Programs);
            if (!string.IsNullOrEmpty(deploymentDescription.Publisher))
                command = Path.Combine(command, deploymentDescription.Publisher);
            if (!string.IsNullOrEmpty(deploymentDescription.SuiteName))
                command = Path.Combine(command, deploymentDescription.SuiteName);
            command = Path.Combine(command, deploymentDescription.Product);
            command = Path.ChangeExtension(command, &quot;.appref-ms&quot;);
        }

        public string Command
        {
            get{return command;}
        }
    }
	

	// your code should do something like ......
	
	        if (ApplicationDeployment.IsNetworkDeployed)
            {
                GetDeploymentDescription(ApplicationDeployment.CurrentDeployment);
            }
	
	// method to asynchronously retrieve ClickOnce &#039;Descriptions&#039; data from host URI

        private void GetDeploymentDescription(ApplicationDeployment currentDeployment)
        {
            var inPlaceHostingManager = new InPlaceHostingManager(currentDeployment.UpdateLocation, false);
            inPlaceHostingManager.GetManifestCompleted += ((sender, e) =&gt;
                                                               {
                                                                   var deploymentDescription = new DeploymentDescription(e.DeploymentManifest);
                                                                   var commandBuilder = new StartMenuCommandBuilder(deploymentDescription);
                                                                   startMenuCommand = commandBuilder.Command;
                                                               });
            inPlaceHostingManager.GetManifestAsync();
        }</description>
		<content:encoded><![CDATA[<p>Hi Ben,</p>
<p>Here&#8217;s the code. You&#8217;ll notice the GetDeploymentDescription() method is asynchronous so you may want to wire up an event to fire when the information is loaded. In my case the code is contained within a class that has a string field &#8216;startMenuCommand&#8217; which is set when the deployment information has been loaded.</p>
<p>Hope this works ok for you.</p>
<p>Cheers,</p>
<p>Andy</p>
<p>// utility class to extract publisher/suiteName/Product</p>
<p>    public class DeploymentDescription<br />
    {<br />
        private const string descriptionElement = &#8220;description&#8221;;<br />
        private const string publisherAttribute = &#8220;publisher&#8221;;<br />
        private const string suiteNameAttribute = &#8220;suiteName&#8221;;<br />
        private const string productAttribute = &#8220;product&#8221;;<br />
        private string publisher;<br />
        private string suiteName;<br />
        private string product;</p>
<p>        public DeploymentDescription(XmlReader xmlDeploymentManifest)<br />
        {<br />
            ExtractDescriptions(xmlDeploymentManifest);<br />
        }</p>
<p>        private void ExtractDescriptions(XmlReader appManifest)<br />
        {<br />
            while (appManifest.Read())<br />
            {<br />
                if (appManifest.NodeType == XmlNodeType.Element)<br />
                {<br />
                    if (appManifest.Name == descriptionElement)<br />
                    {<br />
                        appManifest.MoveToFirstAttribute();<br />
                        do<br />
                        {<br />
                            if (appManifest.Name.Contains(publisherAttribute))<br />
                                publisher = appManifest.Value;<br />
                            else if (appManifest.Name.Contains(suiteNameAttribute))<br />
                                suiteName = appManifest.Value;<br />
                            else if (appManifest.Name.Contains(productAttribute))<br />
                                product = appManifest.Value;<br />
                        } while (appManifest.MoveToNextAttribute());<br />
                        return;<br />
                    }<br />
                }<br />
            }<br />
        }</p>
<p>        public string Publisher<br />
        {<br />
            get { return publisher; }<br />
        }</p>
<p>        public string SuiteName<br />
        {<br />
            get { return suiteName; }<br />
        }</p>
<p>        public string Product<br />
        {<br />
            get { return product; }<br />
        }<br />
    }</p>
<p>	// utility class to build executable command</p>
<p>	public class StartMenuCommandBuilder<br />
    {<br />
        private readonly string command;</p>
<p>        public StartMenuCommandBuilder(DeploymentDescription deploymentDescription)<br />
        {<br />
            if (deploymentDescription == null) throw new ArgumentNullException(&#8220;deploymentDescription&#8221;);<br />
            command = Environment.GetFolderPath(Environment.SpecialFolder.Programs);<br />
            if (!string.IsNullOrEmpty(deploymentDescription.Publisher))<br />
                command = Path.Combine(command, deploymentDescription.Publisher);<br />
            if (!string.IsNullOrEmpty(deploymentDescription.SuiteName))<br />
                command = Path.Combine(command, deploymentDescription.SuiteName);<br />
            command = Path.Combine(command, deploymentDescription.Product);<br />
            command = Path.ChangeExtension(command, &#8220;.appref-ms&#8221;);<br />
        }</p>
<p>        public string Command<br />
        {<br />
            get{return command;}<br />
        }<br />
    }</p>
<p>	// your code should do something like &#8230;&#8230;</p>
<p>	        if (ApplicationDeployment.IsNetworkDeployed)<br />
            {<br />
                GetDeploymentDescription(ApplicationDeployment.CurrentDeployment);<br />
            }</p>
<p>	// method to asynchronously retrieve ClickOnce &#8216;Descriptions&#8217; data from host URI</p>
<p>        private void GetDeploymentDescription(ApplicationDeployment currentDeployment)<br />
        {<br />
            var inPlaceHostingManager = new InPlaceHostingManager(currentDeployment.UpdateLocation, false);<br />
            inPlaceHostingManager.GetManifestCompleted += ((sender, e) =&gt;<br />
                                                               {<br />
                                                                   var deploymentDescription = new DeploymentDescription(e.DeploymentManifest);<br />
                                                                   var commandBuilder = new StartMenuCommandBuilder(deploymentDescription);<br />
                                                                   startMenuCommand = commandBuilder.Command;<br />
                                                               });<br />
            inPlaceHostingManager.GetManifestAsync();<br />
        }</p>
]]></content:encoded>
	</item>
</channel>
</rss>

