<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Aneef.Net &#187; Aneef Fashir</title>
	<atom:link href="http://www.aneef.net/author/admin/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.aneef.net</link>
	<description>Do it in .Net way &#124; Blogging about C#,ASP.Net, LINQ,WPF and .Net Technologies</description>
	<lastBuildDate>Mon, 24 May 2010 10:50:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Fix: .Net 2.0 or 3.5 Setup Project Requires .Net Framework version 4.0</title>
		<link>http://www.aneef.net/2010/05/24/fix-net-2-0-or-3-5-setup-project-requires-net-framework-version-4-0/</link>
		<comments>http://www.aneef.net/2010/05/24/fix-net-2-0-or-3-5-setup-project-requires-net-framework-version-4-0/#comments</comments>
		<pubDate>Mon, 24 May 2010 10:47:57 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
				<category><![CDATA[.Net Related]]></category>
		<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Tricks & Tips]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[.NetFramework4.0]]></category>
		<category><![CDATA[VS2010]]></category>

		<guid isPermaLink="false">http://www.aneef.net/?p=134</guid>
		<description><![CDATA[Sorry again folks again I was MIA with loads and loads of work. trust me i have more than 30 drafts which i started and never got time to finish. anyway coming to the point this morning i was trying to deploy a windows service project using the setup project templates in visual studio 2010, [...]]]></description>
			<content:encoded><![CDATA[<p>Sorry again folks again I was MIA with loads and loads of work. trust me i have more than 30 drafts which i started and never got time to finish. anyway coming to the point this morning i was trying to deploy a windows service project using the setup project templates in visual studio 2010, and when i tried to install it on client machine i got the following message:</p>
<p><a href="http://www.aneef.net/wp-content/uploads/2010/05/5-24-2010-4-00-44-PM.png"><img class="alignnone size-full wp-image-135" title="5-24-2010 4-00-44 PM" src="http://www.aneef.net/wp-content/uploads/2010/05/5-24-2010-4-00-44-PM.png" alt="The Setup Requires the .Net Framework version 4.0" width="446" height="166" /></a></p>
<p>But I&#8217;m pretty sure that i had the project targeted to .net Framework 3.5 SP1, but still it was  requiring .net 4.0.  as usual i did a Google search and found <a href="http://blogs.iis.net/ma_khan/archive/2009/12/02/troubleshooting-net-2-0-setup-requires-net-4-0-runtime.aspx" target="_blank">this article </a>with the trick to resolve it.</p>
<p>actually it was the dependencies in the setup project causing the issue, it was still targetting 4.0 even though my application targets .net 3.5 and by default VS2010 set the dependency to .Net 4.0.</p>
<p>if you have this issue all you have to do is the following :</p>
<ol>
<li>Double click on the dependencies of the setup project.</li>
<li>Click on the .Net Framework</li>
<li>And you will see the Property window will get enabled.</li>
<li>Change the Version property to your desired .net Framework ( in my case 3.5).</li>
<li>and build your setup again.</li>
</ol>
<p>That&#8217;s it <img src='http://www.aneef.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>for the original article that gave me this solution <a href="http://blogs.iis.net/ma_khan/archive/2009/12/02/troubleshooting-net-2-0-setup-requires-net-4-0-runtime.aspx" target="_blank">visit here</a>.</p>
<p>Just thought i would share this information which that might be helpful for those developers who are in migration process to VS2010 <img src='http://www.aneef.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . hope it help guys!!.</p>
<p>Thanks,</p>
<p>Aneef</p>
<img src="http://www.aneef.net/?ak_action=api_record_view&id=134&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2010/05/24/fix-net-2-0-or-3-5-setup-project-requires-net-framework-version-4-0/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Visual Studio 2010 RTM &amp; .Net framework 4.0 Final version released</title>
		<link>http://www.aneef.net/2010/04/12/visual-studio-2010-rtm-net-framework-4-0-final-version-released/</link>
		<comments>http://www.aneef.net/2010/04/12/visual-studio-2010-rtm-net-framework-4-0-final-version-released/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 08:09:26 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
				<category><![CDATA[.Net Related]]></category>
		<category><![CDATA[MSDN]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[bizspark]]></category>
		<category><![CDATA[visualstudio]]></category>
		<category><![CDATA[Websitespark]]></category>

		<guid isPermaLink="false">http://www.aneef.net/?p=132</guid>
		<description><![CDATA[Its been a long time i wrote something on my blog, thanks to my busy work schedule i have a large number of drafts saved lolz. this is just a quick post Anyway today is another big day for .Net developers around the world, yeah the final version of visual studio 2010 is released.  visual [...]]]></description>
			<content:encoded><![CDATA[<p>Its been a long time i wrote something on my blog, thanks to my busy work schedule i have a large number of drafts saved lolz. this is just a quick post</p>
<p>Anyway today is another big day for .Net developers around the world, yeah the final version of visual studio 2010 is released.  visual studio 2010 is the next major  version of its predecessor with loads of new <a href="http://msdn.microsoft.com/en-us/library/bb386063%28VS.100%29.aspx" target="_blank">features</a>.</p>
<p>if you want to see the launch event of visual studio you can see it <a href="http://www.microsoft.com/visualstudio/en-us/watch-it-live" target="_blank">here</a>.</p>
<p><a href="http://weblogs.asp.net/scottgu">Scott Guthrie</a>, and other geeks from microsoft tweeted that visual studio will be available for download around 10 am (PST).  and the good news is its available for the <a href="http://www.microsoft.com/web/websitespark/" target="_blank">websitespark </a>subscribers too <img src='http://www.aneef.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>here are some of those tweets for you :</p>
<blockquote><p>@<a rel="nofollow" href="http://twitter.com/shanselman">shanselman</a>:  Developers: MSDN will be updated with <a title="#vs2010" rel="nofollow" href="http://twitter.com/search?q=%23vs2010">#vs2010</a> downloads and  details at 10am PST *today*! Pls RT! <a rel="bookmark" href="http://twitter.com/Aneef/status/12035037152"></a></p></blockquote>
<blockquote><p><a href="http://twitter.com/scottgu" target="_blank">@scottgu</a>:MSDN Subscribers &amp; WebsiteSpark/BizSpark  members can download VS 2010 Monday morning.</p></blockquote>
<p>happy developing guys <img src='http://www.aneef.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<img src="http://www.aneef.net/?ak_action=api_record_view&id=132&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2010/04/12/visual-studio-2010-rtm-net-framework-4-0-final-version-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visual Studio 2010 RC Now Available for Download</title>
		<link>http://www.aneef.net/2010/02/10/visual-studio-2010-rc-now-available-for-download/</link>
		<comments>http://www.aneef.net/2010/02/10/visual-studio-2010-rc-now-available-for-download/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 22:55:53 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[.Net Framework]]></category>
		<category><![CDATA[Scott Guthrie]]></category>
		<category><![CDATA[VS2010]]></category>

		<guid isPermaLink="false">http://www.aneef.net/?p=127</guid>
		<description><![CDATA[Microsoft has just released the Release Candidate version of Visual Studio 2010 for public download. You can now download and try out Visual Studio 2010 RC and .NET Framework 4 RC before the final version which is due to hit retail in this first quarter of 2010. It was released for MSDN Subscribers on 8th [...]]]></description>
			<content:encoded><![CDATA[<p>Microsoft has just released the Release Candidate version of Visual Studio 2010 for public download. You can now download and try out Visual Studio 2010 RC and .NET Framework 4 RC before the final version which is due to hit retail in this first quarter of 2010. It was released for <a href="http://msdn.microsoft.com/">MSDN </a>Subscribers on 8th February and released for the public just few minutes ago (11th February 2010).</p>
<p><img class="alignnone" title="Visual studio 2010 RC" src="http://www.microsoft.com/visualstudio/en-us/content/images/msdn/placeholder_for_vid.jpg" alt="Visual studio 2010 RC" width="560" height="315" /></p>
<p>It is a much  awaited version of visual studio and it is available in following SKU&#8217;s:</p>
<ul>
<li>Visual Studio 2010 Ultimate</li>
<li>Visual Studio 2010 Premium</li>
<li>Visual Studio 2010 Professional</li>
</ul>
<p>Those who wish to try it, go get your copy <a href="http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx" target="_blank">here</a>.</p>
<p>According to the reviews so far VS 2010 RC seems to be much faster in  Compiling, Building  and Intellisense. Read Scott Guthrie&#8217;s announcement on this release <a href="http://weblogs.asp.net/scottgu/archive/2010/02/08/vs-2010-net-4-release-candidate.aspx" target="_blank">here</a>.</p>
<img src="http://www.aneef.net/?ak_action=api_record_view&id=127&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2010/02/10/visual-studio-2010-rc-now-available-for-download/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SCRUM- Quick Guide</title>
		<link>http://www.aneef.net/2009/11/11/scrum-quick-guide/</link>
		<comments>http://www.aneef.net/2009/11/11/scrum-quick-guide/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 07:32:23 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
				<category><![CDATA[Methodologies]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[SCRUM]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[Youtube]]></category>

		<guid isPermaLink="false">http://www.aneef.net/?p=111</guid>
		<description><![CDATA[I just thought to share this two videos i found in youtube, which is very useful for those who want to learn about SCRUM methodology, wikipedia: Scrum is an iterative incremental framework for managing complex work (such as new product development) commonly used with agile software development. for more info read here. SCRUM Basics by [...]]]></description>
			<content:encoded><![CDATA[<p>I just thought to share this two videos i found in youtube, which is very useful for those who want to learn about SCRUM methodology, <em>wikipedia: <strong>Scrum</strong> is an iterative incremental framework for managing complex work (such as new product development) commonly used with <a title="Agile software development" href="http://en.wikipedia.org/wiki/Agile_software_development">agile software development</a>. </em>for more info read <a href="http://en.wikipedia.org/wiki/Scrum_%28development%29" target="_blank">here</a>.<em> </em></p>
<p><strong>SCRUM Basics by Orjan Hillbom</strong></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/vmGMpME_phg&amp;hl=en&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/vmGMpME_phg&amp;hl=en&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><strong>SCRUM in Under 10 Minutes (HD) by @hamids</strong></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="295" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/Q5k7a9YEoUI&amp;hl=en&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="480" height="295" src="http://www.youtube.com/v/Q5k7a9YEoUI&amp;hl=en&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>hope it helps.</p>
<img src="http://www.aneef.net/?ak_action=api_record_view&id=111&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2009/11/11/scrum-quick-guide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FCKEDitor &#8211; FIXED Image Upload dialog hang for .net</title>
		<link>http://www.aneef.net/2009/09/25/fckeditor-fixed-image-upload-dialog-hang-for-net/</link>
		<comments>http://www.aneef.net/2009/09/25/fckeditor-fixed-image-upload-dialog-hang-for-net/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 11:22:53 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
				<category><![CDATA[.Net Related]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[CKEditor]]></category>
		<category><![CDATA[Continous]]></category>
		<category><![CDATA[FCK Editor]]></category>
		<category><![CDATA[Image]]></category>
		<category><![CDATA[Progress]]></category>
		<category><![CDATA[Upload]]></category>

		<guid isPermaLink="false">http://www.aneef.net/?p=107</guid>
		<description><![CDATA[Well This issue has been bugging alot of people around the net it seems. I&#8217;m one of the victim too *sigh*.. anways bianchi007, a member in the CKSource Site forums had posted a solution. thought it would be worth to share. Here is the solution which was posted in this thread. This is for the [...]]]></description>
			<content:encoded><![CDATA[<p>Well This issue has been bugging alot of people around the net it seems. I&#8217;m one of the victim too *sigh*.. anways <a href="http://cksource.com/forums/memberlist.php?mode=viewprofile&amp;u=12108">bianchi007,</a> a member in the <a href="http://cksource.com/Forums/">CKSource </a>Site forums had posted a solution. thought it would be worth to share.</p>
<p>Here is the solution which was posted in <a href="http://cksource.com/forums/viewtopic.php?f=6&amp;t=12112&amp;p=36585&amp;hilit=image+upload#p36585">this thread</a>.</p>
<p>This is for the .net assembly 2_6_3. I based it on the help file <a href="http://dev.fckeditor.net/attachment/ticket/2115/2115.patch">http://dev.fckeditor.net/attachment/tic &#8230; 2115.patch</a></p>
<p>Steps:</p>
<p>Open the FredCK.FCKeditorV2.vs2005.csproj in Visual Studio 2005</p>
<p>Open the file FileBrowser &gt; FileWorkerBase.cs</p>
<p>Go to line 119</p>
<p>Replace:</p>
<pre class="brush: csharp;">
Response.Write( @&quot;(function(){var d=document.domain;while (true){try{var A=window.top.opener.document.domain;break;}catch(e) {};d=d.replace(/.*?(?:\.|$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})();&quot; );
</pre>
<p>Replace with: </p>
<pre class="brush: csharp;">
Response.Write(@&quot;(function(){var d=document.domain;while (true){try{var A=window.parent.OnUploadCompleted;break;}catch(e) {};d=d.replace(/.*?(?:\.|$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})();&quot;);
</pre>
<p>Compile the project and then reference the new dll file in your project.</p>
<p>I hope it helps <img src='http://www.aneef.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<img src="http://www.aneef.net/?ak_action=api_record_view&id=107&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2009/09/25/fckeditor-fixed-image-upload-dialog-hang-for-net/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Scott Guthrie Announces the WebsiteSpark Program</title>
		<link>http://www.aneef.net/2009/09/24/scott-guthrie-announces-the-websitespark-program/</link>
		<comments>http://www.aneef.net/2009/09/24/scott-guthrie-announces-the-websitespark-program/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 10:06:43 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
				<category><![CDATA[.Net Related]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[visual studio 2008]]></category>
		<category><![CDATA[Expression Blend]]></category>
		<category><![CDATA[ScottGu]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[WebSpark]]></category>

		<guid isPermaLink="false">http://www.aneef.net/?p=104</guid>
		<description><![CDATA[Scott guthrie just did a great announcement about the WebsiteSpark Program. what is WebsiteSpark? WebsiteSpark is designed for independent web developers and web development companies that build web applications and web sites on behalf of others.  It enables you to get software, support and business resources from Microsoft at no cost for three years, and [...]]]></description>
			<content:encoded><![CDATA[<p>Scott guthrie just did a great announcement about the <a href="http://www.microsoft.com/web/websitespark/">WebsiteSpark </a>Program.</p>
<p><strong>what is WebsiteSpark?</strong></p>
<p><span style="font-family: arial; font-size: x-small;"><a href="http://www.microsoft.com/web/websitespark/" target="_blank">WebsiteSpark</a> is designed for independent web developers and web development companies that build web applications and web sites on behalf of others.  It enables you to get software, support and business resources from Microsoft at no cost for three years, and enables you to expand your business and build great web solutions using ASP.NET, Silverlight, SharePoint and PHP, and the <a href="http://www.microsoft.com/web/gallery/default.aspx" target="_blank">open source applications</a> built on top of them.</p>
<h3><span style="text-decoration: underline;">What does the program provide?</span></h3>
<p><a href="http://www.microsoft.com/web/websitespark/" target="_blank">WebSiteSpark</a> provides software licenses that you can use for three years at no cost.  Once enrolled, you can download and immediately use the following software from Microsoft:</p>
<ul>
<li>3 licenses of Visual Studio 2008 Professional Edition</li>
<li>1 license of Expression Studio 3 (which includes Expression Blend, Sketchflow, and Web)</li>
<li>2 licenses of Expression Web 3</li>
<li>4 processor licenses of Windows Web Server 2008 R2</li>
<li>4 processor licenses of SQL Server 2008 Web Edition</li>
<li>DotNetPanel control panel (enabling easy remote/hosted management of your servers)</li>
</ul>
<p>The Windows Server and SQL Server licenses can be used for both development <em>and</em> production deployment.  You can either self-host the servers on your own, or use the licenses with a hoster.  <a href="http://www.microsoft.com/web/websitespark/" target="_blank">WebsiteSpark</a> makes it easy to find hosters who are also enrolled in the program, and who can use your licenses to provide you with either dedicated or virtual dedicated servers to host your sites on.</p>
<p>In addition to software, <a href="http://www.microsoft.com/web/websitespark/" target="_blank">WebsiteSpark</a> provides partner opportunities to grow and build your business (including customer referrals through our partner programs).  It also includes product support (including 2 professional support incidents) and free online training for the products.</p>
<p>for further information on this visit Scotts blog <a href="http://weblogs.asp.net/scottgu/archive/2009/09/24/announcing-the-websitespark-program.aspx">here.</a></p>
<p>Thanks Scott for the great information <img src='http://www.aneef.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p></span></p>
<img src="http://www.aneef.net/?ak_action=api_record_view&id=104&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2009/09/24/scott-guthrie-announces-the-websitespark-program/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ClickOnce Application,Expired Certificates &amp; Public Key Token PART III &#8211; Pushing .net Framework 3.5</title>
		<link>http://www.aneef.net/2009/07/09/clickonce-applicationexpired-certificates-public-key-token-part-iii-pushing-net-framework-3-5/</link>
		<comments>http://www.aneef.net/2009/07/09/clickonce-applicationexpired-certificates-public-key-token-part-iii-pushing-net-framework-3-5/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 11:33:24 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
				<category><![CDATA[.Net Related]]></category>
		<category><![CDATA[ClickOnce]]></category>
		<category><![CDATA[Tricks & Tips]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[visual studio 2008]]></category>
		<category><![CDATA[.Net Installation.]]></category>
		<category><![CDATA[Certificate]]></category>
		<category><![CDATA[Check .Net Framework]]></category>
		<category><![CDATA[Registry]]></category>

		<guid isPermaLink="false">http://www.aneef.net/2009/07/09/clickonce-applicationexpired-certificates-public-key-token-part-iii-pushing-net-framework-3-5/</guid>
		<description><![CDATA[In the last few weeks I wrote 2 articles on how to resolve ClickOnce certificate expiration issues. you can find those articles here : ClickOnce Application,Expired Certificates &#38; Public Key Token PART I ClickOnce Application,Expired Certificates &#38; Public Key Token PART II During my work on this ClickOnce update, we decided to upgrade the application [...]]]></description>
			<content:encoded><![CDATA[<p>In the last few weeks I wrote 2 articles on how to resolve ClickOnce certificate expiration issues. you can find those articles here :</p>
<ol>
<li><a href="http://www.aneef.net/2009/06/11/clickonce-applicationexpired-certificates-public-key-token-part-i/">ClickOnce Application,Expired Certificates &amp; Public Key Token PART I</a>
<li><a href="http://www.aneef.net/2009/06/11/clickonce-applicationexpired-certificates-public-key-token-part-ii/">ClickOnce Application,Expired Certificates &amp; Public Key Token PART II</a> </li>
</ol>
<ol>During my work on this ClickOnce update, we decided to upgrade the application to target .net framework 3.5 sp1.</ol>
<ol>so I just set the target framework to 3.5 and set the required prerequisites (.net 3.5 SP1, and Windows Installer 3.1). and built the project and published it. and when I tried on a client machine which had .net framework 2.0, application got updated, prompted the uninstall message, and tried to launch the new ClickOnce application from the new URL, and BANG!. we get an error :</ol>
<ol><a href="http://www.aneef.net/wp-content/uploads/2009/07/image001.jpg"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image001" src="http://www.aneef.net/wp-content/uploads/2009/07/image001_thumb.jpg" width="286" height="142"></a></ol>
<ol>The Error Message Says :</ol>
<blockquote><p>Unable to install or run the application. The application</p>
<p>requires that assembly WindowsBase Version 3.0.0.0 be</p>
<p>installed in the Global Assembly Cache (GAC) first.</p>
</blockquote>
<p>Why is this ?, its because when we try to launch the new application URL we do this :</p>
<pre>DeploymentUtils.AutoInstall("&lt;Path toNewApplication.application&gt;");</pre>
<pre>&nbsp;</pre>
<p>we request for the application manifest. and it fails to launch the application because it doesn&#8217;t have the prerequisites. and now to force the new prerequisites the application should call the setup.exe in the Web Server instead of the manifest. now the question is, what if the user already have&nbsp; the .net Framework 3.5 SP1?, we don&#8217;t have to prompt the client to install them again by launching setup.exe, we just have to launch the manifest. To Serve both the above scenario we need to check if the client machine has .net framework 3.5 SP1, and depending on its availability we need to launch the manifest or the setup.exe. The existence of .net Framework can be obtained from the following registry location: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP <a href="http://www.aneef.net/wp-content/uploads/2009/07/image.png"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="http://www.aneef.net/wp-content/uploads/2009/07/image_thumb.png" width="544" height="216"></a> you can find out all the .net Frameworks installed and their service pack versions in this registry entry. Following are the locations of the main Net Frameworks:</p>
<table border="0" cellspacing="0" cellpadding="2" width="540">
<tbody>
<tr>
<td valign="top" width="128">Framework 1.1</td>
<td valign="top" width="411">Software\\Microsoft\\NET Framework Setup\\NDP\\v1.1.4322</td>
</tr>
<tr>
<td valign="top" width="128">Framework 2.0</td>
<td valign="top" width="411">Software\\Microsoft\\NET Framework Setup\\NDP\\v2.0.50727</td>
</tr>
<tr>
<td valign="top" width="128">Framework 3.0</td>
<td valign="top" width="411">Software\\Microsoft\\NET Framework Setup\\NDP\\v3.0\\Setup</td>
</tr>
<tr>
<td valign="top" width="128">Framework 3.5</td>
<td valign="top" width="411">Software\\Microsoft\\NET Framework Setup\\NDP\\v3.5</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>Now we can check if the required .net Framework is available in the client machine, and launch the application setup.exe or the manifest. to do this we need to programmatically check these registries. for this I used the attached code ( I Couldn&#8217;t find the original author, Credits goes to him/her) which I found from web and modified to avoid few bugs. you can add this code to your project and do the below check in your application to decide which file to be launched :</p>
<pre class="csharpcode">&nbsp;</pre>
<pre class="csharpcode"><span class="kwrd">string</span> FileToLaunch=<span class="str">@"/setup.exe"</span>;
<span class="kwrd">if</span> (FrameworkUtils.IsInstalled(FrameworkVersion.Fx35)

 &amp;&amp; FrameworkUtils.GetServicePackLevel(FrameworkVersion.Fx35) == 1)
          {
            FileToLaunch = <span class="str">@"/&lt;application manifest.application&gt;"</span>;
          }
            MessageBox.Show(<span class="str">"Your message here"</span>);
            <span class="kwrd">string</span> updateURL = DeploymentUtils.getUpdateURL();
            DeploymentUtils.UninstallMe();
            DeploymentUtils.AutoInstall(<span class="str">"https://"</span> + updateURL + FileToLaunch);
            Application.Exit();</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<pre class="csharpcode">&nbsp;</pre>
<p>And that&#8217;s all, now the application will launch the setup.exe if the client doesn&#8217;t have the .net Framework 3.5 and prompt for its installation, or launch the application manifest if client has the framework installed.</p>
<p>Now you can solve your ClickOnce issue as well as upgrade .net Framework in client machine at the same time without problem.</p>
<p><a href="wp-content/uploads/2009/07/FrameworkUtil.cs.txt">Download FrameworkUtils.cs</a></p>
<p><!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
<img src="http://www.aneef.net/?ak_action=api_record_view&id=97&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2009/07/09/clickonce-applicationexpired-certificates-public-key-token-part-iii-pushing-net-framework-3-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Request UAC Elevation for .net Application (Managed Code)</title>
		<link>http://www.aneef.net/2009/06/29/request-uac-elevation-for-net-application-managed-code/</link>
		<comments>http://www.aneef.net/2009/06/29/request-uac-elevation-for-net-application-managed-code/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 15:35:48 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[visual studio 2008]]></category>
		<category><![CDATA[Administrator]]></category>
		<category><![CDATA[Application Manifest]]></category>
		<category><![CDATA[mt.exe]]></category>
		<category><![CDATA[Permission]]></category>
		<category><![CDATA[UAC]]></category>
		<category><![CDATA[User Account Control]]></category>
		<category><![CDATA[Vista]]></category>
		<category><![CDATA[Windows 7]]></category>
		<category><![CDATA[WindowsPrincipal]]></category>

		<guid isPermaLink="false">http://www.aneef.net/2009/06/29/request-uac-elevation-for-net-application-managed-code/</guid>
		<description><![CDATA[Its about time for us to get ready for Windows 7. and most of us have to develop applications compatible to Windows 7, Vista, and Server 2008. and sometimes we need applications to run with administrative privileges. and that&#8217;s not a big deal. but in these new Operating Systems, even an administrator is sometimes locked [...]]]></description>
			<content:encoded><![CDATA[<p>Its about time for us to get ready for <a href="http://www.microsoft.com/windows/windows-7/" target="_blank">Windows 7</a>. and most of us have to develop applications compatible to Windows 7, Vista, and Server 2008. and sometimes we need applications to run with administrative privileges. and that&#8217;s not a big deal. but in these new Operating Systems, even an administrator is sometimes locked by the <a href="http://en.wikipedia.org/wiki/User_Account_Control" target="_blank">UAC</a> when running some applications.</p>
<p>some applications might throw exceptions in such situation, when we need administrative privileges to do some task, if they don’t request for UAC elevation by the application. only option to make these application is to right click and select “Run as Administrator” to manually trigger UAC.</p>
<p>In this post I’m going to show how to request for UAC Elevation for a .net Application. this explains the use of <a href="http://msdn.microsoft.com/en-us/library/aa374191(VS.85).aspx" target="_blank">Application Manifests</a> that request the OS for UAC elevation. </p>
<p>&#160;</p>
<h2>Code</h2>
<p>I have my sample windows form C# Project with a single form that shows a message box on form load,showing whether you are an administrator or not.</p>
<p>&#160;</p>
<pre class="csharpcode">  <span class="kwrd">private</span> <span class="kwrd">void</span> Form1_Load(<span class="kwrd">object</span> sender, EventArgs e)
        {
         <span class="kwrd">bool</span> isAdmin = <span class="kwrd">new</span> WindowsPrincipal(WindowsIdentity.GetCurrent())</pre>
<pre class="csharpcode">                   .IsInRole(WindowsBuiltInRole.Administrator) ? <span class="kwrd">true</span> : <span class="kwrd">false</span>;

            <span class="kwrd">if</span>(isAdmin)
            {
                MessageBox.Show(<span class="str">&quot;you are an administrator&quot;</span>);
            }
            <span class="kwrd">else</span>
            {
                MessageBox.Show(<span class="str">&quot;You are not an administrator&quot;</span>);
            }
        }</pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>&#160;</p>
<p>in the above code we use <a href="http://msdn.microsoft.com/en-us/library/system.security.principal.windowsprincipal.aspx" target="_blank">WindowsPrincipal</a> class, which allows us to check the Windows group membership of a Windows user. to use this classes un need to use the following namespace in the code:</p>
<pre class="csharpcode"><span class="kwrd">using</span> System.Security.Principal;</pre>
<pre class="csharpcode">&#160;</pre>
<p>when you compile this application and run , you would expect that it will show the message saying “you are an administrator” if you are logged in as an administrator account. well this is what you get if you have UAC enabled, not something you expected right ?</p>
<p><a href="http://www.aneef.net/wp-content/uploads/2009/06/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.aneef.net/wp-content/uploads/2009/06/image_thumb.png" width="221" height="156" /></a> </p>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>ok now we need to make our application to request for UAC elevation.&#160; first we need to create a manifest file with the application name.</p>
<h2>Create Manifest File</h2>
<p>First add a new item to the project with the name with following format, &lt;applicationname&gt;.exe.manifest . in our case (ElevationTest.exe.manifest). and add the following XML:</p>
<pre class="csharpcode"><span class="kwrd">&lt;?</span><span class="html">xml</span> <span class="attr">version</span><span class="kwrd">=&quot;1.0&quot;</span> <span class="attr">encoding</span><span class="kwrd">=&quot;UTF-8&quot;</span> <span class="attr">standalone</span><span class="kwrd">=&quot;yes&quot;</span>?<span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">assembly</span> <span class="attr">xmlns</span><span class="kwrd">=&quot;urn:schemas-microsoft-com:asm.v1&quot;</span> <span class="attr">manifestVersion</span><span class="kwrd">=&quot;1.0&quot;</span><span class="kwrd">&gt;</span>
   <span class="kwrd">&lt;</span><span class="html">assemblyIdentity</span> <span class="attr">version</span><span class="kwrd">=&quot;1.0.0.0&quot;</span>  <span class="attr">name</span><span class="kwrd">=&quot;ElevationTest&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;win32&quot;</span><span class="kwrd">/&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">trustInfo</span> <span class="attr">xmlns</span><span class="kwrd">=&quot;urn:schemas-microsoft-com:asm.v3&quot;</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">security</span><span class="kwrd">&gt;</span>
         <span class="kwrd">&lt;</span><span class="html">requestedPrivileges</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">requestedExecutionLevel</span> <span class="attr">level</span><span class="kwrd">=&quot;requireAdministrator&quot;</span><span class="kwrd">/&gt;</span>
         <span class="kwrd">&lt;/</span><span class="html">requestedPrivileges</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;/</span><span class="html">security</span><span class="kwrd">&gt;</span>
   <span class="kwrd">&lt;/</span><span class="html">trustInfo</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">assembly</span><span class="kwrd">&gt;</span></pre>
<p>&#160;</p>
<p>and the next step is to add the manifest in to the built executables Win32Resources by embedding it.&#160; to do this we need to use the MT.exe in the .Net SDK.&#160; by default it can be found in “C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\”.</p>
<p>we can use the following command to embed the manifest through visual studio command line:</p>
<p><strong>mt.exe –manifest MyApp.exe.manifest -outputresource:MyApp.exe;1</strong> </p>
<p>or </p>
<p><strong>mt.exe –manifest MyLibrary.dll.manifest -outputresource:MyLibrary.dll;2</strong> </p>
<p>(1 for an EXE, 2 for a DLL.) </p>
<p>to make things easier we can add this command to the postbuild event of the project :</p>
<p><a href="http://www.aneef.net/wp-content/uploads/2009/06/image1.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.aneef.net/wp-content/uploads/2009/06/image_thumb1.png" width="549" height="328" /></a><br />
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
</p>
<p>below is the full&#160; post build command:</p>
<p>&quot;C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\mt.exe&quot; -manifest &quot;$(ProjectDir)$(TargetName).exe.manifest&quot;&#160; –outputresource:&quot;$(TargetDir)$(TargetFileName)&quot;;#1</p>
<p>once you have built the application successfully if you see the output directory you will see the icons will have a shield on them indicating that the application requires UAC elevation.</p>
<p><a href="http://www.aneef.net/wp-content/uploads/2009/06/image2.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.aneef.net/wp-content/uploads/2009/06/image_thumb2.png" width="322" height="159" /></a> </p>
<p>And now if you run your built application it will prompt for UAC : and when you click on allow the application will show you the following Message : </p>
<p>&#160;</p>
<p><a href="http://www.aneef.net/wp-content/uploads/2009/06/image3.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.aneef.net/wp-content/uploads/2009/06/image_thumb3.png" width="199" height="156" /></a> </p>
<p>That’s it you have your application ready to request UAC Elevation in the new operating systems.</p>
<p>&#160;</p>
<p>hope it helps.</p>
<p><a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fwww.aneef.net%2f2009%2f06%2f29%2frequest-uac-elevation-for-net-application-managed-code%2f"><img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.aneef.net%2f2009%2f06%2f29%2frequest-uac-elevation-for-net-application-managed-code%2f" /></a></p>
<p><!-- BEGIN SMOWTION TAG - 468x60 - aneef net: tecnologia - DO NOT MODIFY --><br />
<script type="text/javascript"><!--
smowtion_size = "468x60";
smowtion_section = "642940";
//-->
</script><br />
<script type="text/javascript" src="http://ads.smowtion.com/ad.js">
</script><br />
<!-- END SMOWTION TAG - 468x60 - aneef net: tecnologia - DO NOT MODIFY --></p>
<img src="http://www.aneef.net/?ak_action=api_record_view&id=87&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2009/06/29/request-uac-elevation-for-net-application-managed-code/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>ClickOnce Application,Expired Certificates &amp; Public Key Token PART II</title>
		<link>http://www.aneef.net/2009/06/11/clickonce-applicationexpired-certificates-public-key-token-part-ii/</link>
		<comments>http://www.aneef.net/2009/06/11/clickonce-applicationexpired-certificates-public-key-token-part-ii/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 10:40:36 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
				<category><![CDATA[ClickOnce]]></category>
		<category><![CDATA[visual studio 2008]]></category>
		<category><![CDATA[Certificate]]></category>
		<category><![CDATA[Public Token Key]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.aneef.net/2009/06/11/clickonce-applicationexpired-certificates-public-key-token-part-ii/</guid>
		<description><![CDATA[In the first part of this series I wrote the possible solutions available for the ClicOnce certificate issue. if you have missed it please read it before continuing. ClickOnce Application,Expired Certificates &#38; Public Key Token PART I This post is not going to be a long one, I&#160; just want to point out a very [...]]]></description>
			<content:encoded><![CDATA[<p>In the <a href="http://www.aneef.net/2009/06/11/clickonce-applicationexpired-certificates-public-key-token-part-i/" target="_blank">first part</a> of this series I wrote the possible solutions available for the ClicOnce certificate issue. if you have missed it please read it before continuing.</p>
<ol>
<ol>
<ul>
<li><a href="http://www.aneef.net/2009/06/11/clickonce-applicationexpired-certificates-public-key-token-part-i/" target="_blank">ClickOnce Application,Expired Certificates &amp; Public Key Token PART I</a></li>
</ul>
<ul>This post is not going to be a long one, I&nbsp; just want to point out a very important issue, when updating the ClickOnce using the method specified in <a href="http://www.aneef.net/2009/06/11/clickonce-applicationexpired-certificates-public-key-token-part-i/" target="_blank">PART I</a> . </ul>
<ul>When using <a href="http://www.jamesharte.com/blog/?p=11" target="_blank">Jim Harte&#8217;s</a> Method to update a ClickOnce with a new certificate, it checks for the public token key of the current application to find its uninstall string, and then execute runDLL32 to trigger the uninstall. below is the code which gets the uninstall string:</ul>
<ul></ul>
<ol>
<pre class="csharpcode"><span class="rem">/// &lt;summary&gt;</span>
<span class="rem">/// Gets the uninstall string for the current ClickOnce app from the Windows </span>
<span class="rem">/// Registry.</span>
<span class="rem">/// &lt;/summary&gt;</span>
<span class="rem">/// &lt;param name="PublicKeyToken"&gt;The public key token of the app.&lt;/param&gt;</span>
<span class="rem">/// &lt;returns&gt;The command line to execute that will uninstall the app.&lt;/returns&gt;</span>
 <span class="kwrd">private</span> <span class="kwrd">static</span> <span class="kwrd">string</span> GetUninstallString(<span class="kwrd">string</span> PublicKeyToken,</pre>
<pre class="csharpcode">                          <span class="kwrd">out</span> <span class="kwrd">string</span> DisplayName)
{
 <span class="kwrd">string</span> uninstallString = <span class="kwrd">null</span>;
 <span class="kwrd">string</span> searchString = <span class="str">"PublicKeyToken="</span> + PublicKeyToken;
 RegistryKey uninstallKey = _
      Registry.CurrentUser.OpenSubKey</pre>
<pre class="csharpcode">                (<span class="str">"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall"</span>);
 <span class="kwrd">string</span>[] appKeyNames = uninstallKey.GetSubKeyNames();
 DisplayName = <span class="kwrd">null</span>;
 <span class="kwrd">foreach</span>(<span class="kwrd">string</span> appKeyName <span class="kwrd">in</span> appKeyNames)
{
  RegistryKey appKey = uninstallKey.OpenSubKey(appKeyName);
  uninstallString = (<span class="kwrd">string</span>)appKey.GetValue(<span class="str">"UninstallString"</span>);
  DisplayName = (<span class="kwrd">string</span>)appKey.GetValue(<span class="str">"DisplayName"</span>);
  appKey.Close();

 <span class="kwrd">if</span>(uninstallString.Contains(searchString))
                    <span class="kwrd">break</span>;
 }
            uninstallKey.Close();
            <span class="kwrd">return</span> uninstallString;
        }</pre>
<pre class="csharpcode">&nbsp;</pre>
<p>&nbsp;</p>
<p>In the above code it goes through registry keys of all ClickOnce application to get the uninstall string. and if that uninstall string contains the Public Token key of the current application, it will uninstall the application with that particular uninstall string. this is completely ok if there is only one application with that public token key. <strong>the public key of an assembly name identifies the developer (or the organization). Most organizations use only one public key to sign their assemblies with</strong>. so what if there is more than 1 application which has the same public token key?</p>
</ol>
<li>The code will uninstall the very first match in the above code and it might uninstall some other application, instead of uninstalling the one we need to uninstall.
<li>and it will&nbsp; also install the new application from new URL, but with a different name sometimes (Eg: application name -1).
<li>And if it had uninstalled another application, whenever user launches this application it will prompt the uninstall screen, each time when there are more than 1 application with the same public token key.</li>
</ol>
</ol>
<p>The Image below shows an uninstall string, which contains the application name, and public token key:</p>
<p><a href="http://www.aneef.net/wp-content/uploads/2009/06/debug.jpg"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="debug" src="http://www.aneef.net/wp-content/uploads/2009/06/debug-thumb.jpg" width="558" height="102"></a> </p>
<p>To avoid this problem of wrong application getting uninstalled, I changed this part of the code from above code to :</p>
<pre class="csharpcode"><span class="kwrd">if</span>(uninstallString.Contains(searchString)) <span class="kwrd">break</span>; </pre>
<p><style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
</p>
<p>this:</p>
<pre class="csharpcode"><span class="kwrd">if</span>(uninstallString.Contains(searchString)
               &amp;&amp; uninstallString.Contains(<span class="str">"yourApp.application"</span>))
                    <span class="kwrd">break</span>;</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<ol>
<ol>
<ol>
<p>&nbsp;</p>
<p>In the code above, I&#8217;m Checking the ClickOnce application name with extension, along with the public token key to find out the correct uninstall string. that&#8217;s it!. </p>
<p>Hope this solves your time in someway. </p>
<p><style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
</p>
</ol>
</ol>
</ol>
<img src="http://www.aneef.net/?ak_action=api_record_view&id=73&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2009/06/11/clickonce-applicationexpired-certificates-public-key-token-part-ii/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>ClickOnce Application,Expired Certificates &amp; Public Key Token PART I</title>
		<link>http://www.aneef.net/2009/06/11/clickonce-applicationexpired-certificates-public-key-token-part-i/</link>
		<comments>http://www.aneef.net/2009/06/11/clickonce-applicationexpired-certificates-public-key-token-part-i/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 09:05:36 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
				<category><![CDATA[ClickOnce]]></category>
		<category><![CDATA[visual studio 2008]]></category>
		<category><![CDATA[.Net Framework]]></category>
		<category><![CDATA[Certificate]]></category>
		<category><![CDATA[Error]]></category>
		<category><![CDATA[thawte]]></category>
		<category><![CDATA[Update]]></category>
		<category><![CDATA[verisign]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[VS2008]]></category>

		<guid isPermaLink="false">http://www.aneef.net/2009/06/11/clickonce-applicationexpired-certificates-public-key-token-part-i/</guid>
		<description><![CDATA[Well, by this time I&#8217;m sure most of the ClickOnce application developers are aware of this problem. if you aren&#8217;t here is a basic description of what the problem is: Problem description ClickOnce allows application updates, only if the updated application manifests are signed with the same certificate (publisher) as was used to originally sign [...]]]></description>
			<content:encoded><![CDATA[<p>Well, by this time I&#8217;m sure most of the ClickOnce application developers are aware of this problem. if you aren&#8217;t here is a basic description of what the problem is:</p>
<blockquote style="width: 85%; height: 285px"><p><strong>Problem description</strong></p>
<p>ClickOnce allows application updates, only if the updated application manifests are signed with the same certificate (publisher) as was used to originally sign the application manifests. However, most CA&#8217;s like Verisign, and many enterprise customers own CA&#8217;s generate new certificates with new key pairs and only the same common name (CN). </p>
<p>The certificate is used for the Authenticode signature element and for the strong name signature element of the manifest file to protect it against tampering, and to provide identity information for the trust manager. If the signing certificate expires and you publish an application update with a renewed certificate which has different keys, then the update will fail with the error message described in the <a href="http://support.microsoft.com/kb/925521/en-us" target="_blank">KB article.</a></p>
</blockquote>
<p>&nbsp;</p>
<p>There are lots of issues, and threads are being discussed how to resolve this issue. and these are the preferable solutions available on net.</p>
<ol>
<li>Manually Uninstall and Re install the application with new certificate &#8211; which we cannot do when we have a large number of client base who are using our ClickOnce Applicaiton.
<li>Install .net Framework 2.0 SP1 for XP /&nbsp; .Net Framework 3.5 SP1 for vista or later, in these service pack s for .net Framework, this bug is fixed, and it will seamlessly update the application. &#8211; but we cannot force or inform clients to do that. yeah by this time most of the users might have installed .net framework 3.5 sp1 through windows automatic updates. but even if one guy haven&#8217;t done that KABOOM!!, clients are going to complain.
<li>Sign the new click once with 2 different keys &#8211; a solution by <a href="http://blogs.msdn.com/danielma/contact.aspx">Daniel Margetic</a> , even though developers may like it, when considering Automation, and&nbsp; Infrastructure of build servers this might not be a favorite solution.
<li>Automatically Uninstalling the old application, and re-install the new application. &#8211; a solution by <a href="http://www.jamesharte.com/blog/?p=11" target="_blank">Jim Harte</a> , using this method, we will be releasing an update for the application with expired certificate, which will have scripts for automatically uninstall the applicaiton, and install the application with new certificate, from a new location. the following thread on MSDN explains this process completely: <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/1217520d-6dc4-4fb1-83d1-0fa148d60e5d" target="_blank">VS2008 SP-1 change certificate, user can&#8217;t pick up update</a> </p>
<p>The last one seems to be a favorite of most of the people around the globe. it uses <a href="http://www.jamesharte.com/downloads/ClickOnceReinstall.zip" target="_blank">these classes</a> by&nbsp; Jim Harte&nbsp; to uninstall and re install the application, using the following code: </li>
</ol>
<pre class="csharpcode">MessageBox.Show(<span class="str">"Your Message to Client"</span>);
DeploymentUtils.UninstallMe()
DeploymentUtils.AutoInstall(<span class="str">"&lt;Path toNewApplication.application&gt;"</span>);
Application.Exit();</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>&nbsp;</p>
<p>you can have the new path as a sub folder of current applications update URL. you can get a ClickOnce applicaitons update URL using the line below :</p>
<pre class="csharpcode">ApplicationDeployment.CurrentDeployment.UpdateLocation.Host</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p><style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
</p>
<p>That would do the trick. so what is it about Public Token Key ??. I will explain this in the PART 2 of this article.</p>
<p>Hope it helps,</p>
<p>Aneef</p>
<p><strong>I just posted the Part II of this series is </strong><a href="http://www.aneef.net/2009/06/11/clickonce-applicationexpired-certificates-public-key-token-part-ii/"><strong>here</strong></a><strong>.</strong></p>
<p><strong>Special Note:</strong></p>
<p>Thanks to <a href="http://robindotnet.wordpress.com/" target="_blank">RobinDotNet</a> for his wonderful support through MSDN and through his blog to solve this problem.</p>
<img src="http://www.aneef.net/?ak_action=api_record_view&id=69&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2009/06/11/clickonce-applicationexpired-certificates-public-key-token-part-i/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
