<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>You had me at "Hello World" : Visual Studio</title><link>http://blogs.msdn.com/helloworld/archive/tags/Visual+Studio/default.aspx</link><description>Tags: Visual Studio</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>How to Install Assemblies to the GAC Programmatically?</title><link>http://blogs.msdn.com/helloworld/archive/2008/09/22/how-to-install-assemblies-to-the-gac-programmatically.aspx</link><pubDate>Mon, 22 Sep 2008 18:06:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8961665</guid><dc:creator>HelloWorld</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/helloworld/comments/8961665.aspx</comments><wfw:commentRss>http://blogs.msdn.com/helloworld/commentrss.aspx?PostID=8961665</wfw:commentRss><description>&lt;p&gt;You can add or remove assemblies from the GAC using code. You can use &lt;a href="http://msdn.microsoft.com/en-us/library/system.enterpriseservices.internal.publish.gacinstall.aspx"&gt;Publish.GacInstall&lt;/a&gt; method to install an assembly to the GAC, or &lt;a href="http://msdn.microsoft.com/en-us/library/system.enterpriseservices.internal.publish.gacremove.aspx"&gt;Publish.GacRemove&lt;/a&gt; method to remove that assembly from the GAC.&lt;/p&gt;  &lt;p&gt;If you are using Vista, and enable UAC, you have to run this code using elevated command (run as Administrator), otherwise it won't work.&lt;/p&gt;  &lt;p&gt;The other thing that I discovered, this code won't install assembly that is not signed, unfortunately, I did not see any error message/exception. So check if the assembly is a strong-name assembly before installing it.&lt;/p&gt;  &lt;p&gt;To check if an assembly is signed:&lt;/p&gt;  &lt;pre class="code"&gt;System.Reflection.&lt;span style="color: #2b91af"&gt;Assembly&lt;/span&gt;.LoadFile(&lt;span style="color: #a31515"&gt;&amp;quot;My.Cool.Assembly.dll&amp;quot;&lt;/span&gt;).GetName().GetPublicKey().Length &amp;gt; 0;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;To install an assembly into the GAC:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;new &lt;/span&gt;System.EnterpriseServices.Internal.&lt;span style="color: #2b91af"&gt;Publish&lt;/span&gt;().GacInstall(&lt;span style="color: #a31515"&gt;&amp;quot;My.Cool.Assembly.dll&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;To uninstall an assembly from the GAC:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;new &lt;/span&gt;System.EnterpriseServices.Internal.&lt;span style="color: #2b91af"&gt;Publish&lt;/span&gt;().GacRemove(&lt;span style="color: #a31515"&gt;&amp;quot;My.Cool.Assembly.dll&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8961665" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/helloworld/archive/tags/.Net+Framework/default.aspx">.Net Framework</category><category domain="http://blogs.msdn.com/helloworld/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://blogs.msdn.com/helloworld/archive/tags/How+to/default.aspx">How to</category></item><item><title>CustomActionData and User Defined Path</title><link>http://blogs.msdn.com/helloworld/archive/2008/04/08/customactiondata-and-user-defined-path.aspx</link><pubDate>Tue, 08 Apr 2008 06:11:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8367430</guid><dc:creator>HelloWorld</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/helloworld/comments/8367430.aspx</comments><wfw:commentRss>http://blogs.msdn.com/helloworld/commentrss.aspx?PostID=8367430</wfw:commentRss><description>&lt;p&gt;When designing a setup project, you can define text boxes dialog to input a file system path. To process the input that the user has entered, usually a custom action is created to handle the user input, and the user input is passed through CustomActionData property. Unfortunately, there are several problems when dealing with path.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Spaces in the path      &lt;br /&gt;A space is a valid character for a path. If the user passes a path with a space in it, you should enclose the input with double-quotes, for example, this is a CustomActionData property value: /USERDEFINEDDATA=&amp;quot;[USERPATH]&amp;quot;.       &lt;br /&gt;This leads to a different problem below. &lt;/li&gt;    &lt;li&gt;Backslashes trimmed.      &lt;br /&gt;When the user enters a UNC path starting with &amp;quot;\\&amp;quot;, if the value property is enclosed with double-quotes, the string that is passed to the custom action contains only one '\'. Not really a problem, you have to check if the path is a UNC path and make sure there are two '\'. &lt;/li&gt;    &lt;li&gt;Trailing backslash caused an exception.      &lt;br /&gt;This is an interesting problem. As soon as the user enters a path, either absolute path or a UNC path and ended the path with a backslash, the user will get this error when running the setup.&amp;#160; &lt;br /&gt;&lt;strong&gt;       &lt;br /&gt;&lt;/strong&gt;Error 1001: Exception occurred while initializing the installation:      &lt;br /&gt;System.IO.FileNotFoundException. Could not load file or assembly:      &lt;br /&gt;'file:///C:\WINNT\[Your assembly name here]' or one of its dependencies.      &lt;br /&gt;The system could not find the file specified.      &lt;br /&gt;      &lt;br /&gt;This error happens only when the CustomActionData inside double-quotes.       &lt;br /&gt;      &lt;br /&gt;If you check my previous &lt;a href="http://blogs.msdn.com/helloworld/archive/2008/03/11/did-you-know-how-to-correctly-pass-targetdir-to-a-custom-action.aspx"&gt;post&lt;/a&gt; about passing [TARGETDIR] to custom action, you notice that you have to pass a backslash at the end. You can do the same with a user defined path, something like this /USERDEFINEDDATA=&amp;quot;[USERPATH]\&amp;quot;. This code works great if the user enters a path with a trailing backslash, and there will be only ONE trailing backslash. The problem is if the user did not supply the trailing backslash, the user will get the same 1001 error again.       &lt;br /&gt;      &lt;br /&gt;My solution is this, set CustomActionData with a character that you know is not a valid path character, for example a Pipe character ('|'). Assign your CustomActionData like this /USERDEFINEDDATA=&amp;quot;[USERPATH]&lt;strong&gt;|&lt;/strong&gt;&amp;quot;. With this, a user defined path with trailing backslash will come to the custom action as &amp;quot;C:\some Path\some path\|&amp;quot;, and user defined path without a trailing backslash will come to the custom action as &amp;quot;C:\Some Path\Some Path|&amp;quot;. What you have to do now is to trim the '|' character, and you are good. Now you have a code that can handle user input with or without trailing backslash. &lt;/li&gt; &lt;/ul&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8367430" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/helloworld/archive/tags/Programming/default.aspx">Programming</category><category domain="http://blogs.msdn.com/helloworld/archive/tags/.Net+Framework/default.aspx">.Net Framework</category><category domain="http://blogs.msdn.com/helloworld/archive/tags/Setup+Project/default.aspx">Setup Project</category><category domain="http://blogs.msdn.com/helloworld/archive/tags/Visual+Studio/default.aspx">Visual Studio</category></item><item><title>Having Fun with VS Setup Project - Database Deployment</title><link>http://blogs.msdn.com/helloworld/archive/2008/01/30/having-fun-with-vs-setup-project-database-deployment.aspx</link><pubDate>Wed, 30 Jan 2008 21:08:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7331123</guid><dc:creator>HelloWorld</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/helloworld/comments/7331123.aspx</comments><wfw:commentRss>http://blogs.msdn.com/helloworld/commentrss.aspx?PostID=7331123</wfw:commentRss><description>&lt;p&gt;I was given a new task, to create an installer for internal use. I wrote installer before, but it was three years ago, a lot of things have changed.&lt;/p&gt;  &lt;p&gt;One of the installer task is to create a sql server db using a script. After much reading, searching, and testing, I got into this msdn article. &lt;a title="http://msdn2.microsoft.com/en-us/library/49b92ztk.aspx" href="http://msdn2.microsoft.com/en-us/library/49b92ztk.aspx"&gt;http://msdn2.microsoft.com/en-us/library/49b92ztk.aspx&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;The article was good enough to get me started, the only thing is, the source code was in VB instead of C#. If you decided to follow that example above using C#, there is a chance that you may asked yourself about C# equivalent of VB's My.Settings. Don't worry too much, it just a strong-typed application setting. Just use ConfigurationManager, if you are more comfortable with it.&lt;/p&gt;  &lt;p&gt;If you have done database deployment using msi in the past, I will appreciate some feedback or information.&lt;/p&gt;  &lt;p&gt;Stay tuned, I am planning to add more stuff that I learned from building setup project using VS 2005. &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7331123" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/helloworld/archive/tags/.Net+Framework/default.aspx">.Net Framework</category><category domain="http://blogs.msdn.com/helloworld/archive/tags/Setup+Project/default.aspx">Setup Project</category><category domain="http://blogs.msdn.com/helloworld/archive/tags/Visual+Studio/default.aspx">Visual Studio</category></item></channel></rss>