<?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>Jigar Mehta's Blog : .NET</title><link>http://blogs.msdn.com/jigarme/archive/tags/.NET/default.aspx</link><description>Tags: .NET</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>How to register .NET Assembly for COM Interop ?</title><link>http://blogs.msdn.com/jigarme/archive/2008/04/28/how-to-register-net-assembly-for-com-interop.aspx</link><pubDate>Mon, 28 Apr 2008 16:55:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8435417</guid><dc:creator>Jigar Mehta</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/jigarme/comments/8435417.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jigarme/commentrss.aspx?PostID=8435417</wfw:commentRss><description>&lt;p&gt;Do you want to use your .NET DLL (assembly) from VB6 or C++ application (native code) ? Yes, you can do that using COM Interop. As per COM rules, you need to get your assembly registered on system (in Registry, yes, thats how COM works!).&lt;/p&gt;  &lt;p&gt;To get an assembly registered on system, you can use regasm utility that comes with .net framework.&lt;/p&gt;  &lt;p&gt;If you have .NET Framework 2.0 installed, regasm would be in following path (assuming you have 32-bit OS)   &lt;br /&gt;C:\windows\microsoft.net\Framework\v2.0.50727\regasm.exe&lt;/p&gt;  &lt;p&gt;If you have 64-bit OS as well as .NET framework installed, you should find 32bit version of regasm in,   &lt;br /&gt;C:\windows\microsoft.net\&lt;strong&gt;Framework&lt;/strong&gt;\v2.0.50727\regasm.exe&lt;/p&gt;  &lt;p&gt;and 64 bit version of regasm should be in,   &lt;br /&gt;C:\windows\microsoft.net\&lt;strong&gt;Framework64&lt;/strong&gt;\v2.0.50727\regasm.exe&lt;/p&gt;  &lt;p&gt;More on regasm and its command line options is described &lt;a href="http://msdn2.microsoft.com/en-us/library/tzat5yw6(VS.71).aspx" target="_blank"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;If you are developing project in Visual Studio, there is option to register your assembly with COM Interop in Project Properties (Right click on project and choose properties), Go to Build tab, There is an option for &amp;quot;Register for COM Interop&amp;quot;. (Basically what it does is, it calls regasm after DLL is built!)&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/Howtoregister.NETAssemblyforCOMInterop_1110C/image_2.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="501" alt="image" src="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/Howtoregister.NETAssemblyforCOMInterop_1110C/image_thumb.png" width="717" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;There are two options while registering the assembly for COM Interop,&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Put your assembly in GAC.&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;If you put your assembly in GAC, you don't have to use /codebase command line switch with regasm, because application will be able to find the assembly using default probing mechanisms.&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;Assembly is not in GAC.&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;Its advisable to use /codebase command line switch when you dont have your assembly in GAC because that will add absolute path for your assembly in registry so that COM client (your native application which uses .NET assembly) can find it.&lt;/li&gt;      &lt;li&gt;Following is what will be written in case if you choose to use /codebase option while registering. (notice the CodeBase key).&lt;/li&gt;   &lt;/ul&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/Howtoregister.NETAssemblyforCOMInterop_1110C/image_4.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="165" alt="image" src="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/Howtoregister.NETAssemblyforCOMInterop_1110C/image_thumb_1.png" width="1217" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Stay tuned.. &lt;img alt="Wave" src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/103.gif" /&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8435417" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jigarme/archive/tags/Interop/default.aspx">Interop</category><category domain="http://blogs.msdn.com/jigarme/archive/tags/COM/default.aspx">COM</category><category domain="http://blogs.msdn.com/jigarme/archive/tags/.NET/default.aspx">.NET</category></item><item><title>Want to see GAC in its naked view?</title><link>http://blogs.msdn.com/jigarme/archive/2007/06/20/want-to-see-assembly-in-its-naked-view.aspx</link><pubDate>Wed, 20 Jun 2007 03:51:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3414999</guid><dc:creator>Jigar Mehta</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jigarme/comments/3414999.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jigarme/commentrss.aspx?PostID=3414999</wfw:commentRss><description>&lt;p&gt;For one of my customer's debugging scenario, I was searching for a technique to view the GAC in its simple file-folder view. (For those of you who does not know GAC [C:\windows\assembly] is just a decorated view implemented in shfusion.dll in framework folder.. Refer to [http://msdn2.microsoft.com/en-us/library/34149zk3(vs.80).aspx] for more information.&lt;/p&gt; &lt;p&gt;So, there are two tricks to see GAC in its file-folder (naked) view! One is somewhat longer which I am not going to describe here, another is barely creating one registry key!&lt;/p&gt; &lt;p&gt;You can simply go to,&lt;br&gt;&lt;span id="intelliTXT" name="intelliTxt"&gt;&lt;code&gt;HKLM\Software\Microsoft\Fusion&lt;/code&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;and create a DWORD value named "DisableCacheViewer" and set it to value 1.&lt;/p&gt; &lt;p&gt;Just go ahead and open another instance of windows explorer, explore to c:\windows\assembly now and you see magic there!! Directory structure inside assembly folder is also very logical, but some other time, will write a post on it.&lt;/p&gt; &lt;p&gt;Stay tuned.. &lt;img alt="Wave" src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/103.gif"&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3414999" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jigarme/archive/tags/.NET/default.aspx">.NET</category></item><item><title>.NET Framework Configuration Tool</title><link>http://blogs.msdn.com/jigarme/archive/2007/05/04/net-framework-configuration-tool.aspx</link><pubDate>Fri, 04 May 2007 20:16:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2412387</guid><dc:creator>Jigar Mehta</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jigarme/comments/2412387.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jigarme/commentrss.aspx?PostID=2412387</wfw:commentRss><description>&lt;p&gt;Just now, i was searching for something to set the redirection for .NET assembly. Like, for assembly versions 1.0.0.0 to 1.7.85.995 should be loading the latest assembly from the company, that is, 1.8.0.0&lt;/p&gt; &lt;p&gt;Tried searching for writing the config file (i know this can be possible by Redirection policy configuration file..) But found one good GUI tool by which this can be possible.&lt;/p&gt; &lt;p&gt;It is .NET Framework Configuration Tool,&lt;br&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/2bc0cxhc(VS.80).aspx"&gt;http://msdn2.microsoft.com/en-us/library/2bc0cxhc(VS.80).aspx&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2412387" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jigarme/archive/tags/.NET/default.aspx">.NET</category></item><item><title>Enabling .NET studio Windows Service project to work with installutil.exe</title><link>http://blogs.msdn.com/jigarme/archive/2007/05/04/enabling-net-studio-windows-service-project-to-work-with-installutil-exe.aspx</link><pubDate>Fri, 04 May 2007 00:19:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2399640</guid><dc:creator>Jigar Mehta</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jigarme/comments/2399640.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jigarme/commentrss.aspx?PostID=2399640</wfw:commentRss><description>&lt;p&gt;I was just trying to create a simple C#.NET windows service with visual studio .NET 2005. After selecting Windows Service template, I got the template code for common required service infrastructure lik, OnStart() and OnStop() methods.&lt;/p&gt; &lt;p&gt;I added my custom code in necessary methods and tried to register it using installutil.exe but was not able to see that in Service Control Manager.&lt;/p&gt; &lt;p&gt;Actually we have to add the ServiceInstaller file to the project and add some code to that file.&lt;/p&gt; &lt;p&gt;We have to add following two member variable for that ServiceInstaller template class,&lt;/p&gt; &lt;h1&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller1;  &lt;h1&gt;&lt;/h1&gt;&amp;nbsp;&amp;nbsp;private System.ServiceProcess.ServiceInstaller serviceInstaller1;  &lt;h1&gt;&lt;/h1&gt;&lt;/font&gt;&lt;/h1&gt; &lt;h1&gt;&lt;font face="Courier New" size="2"&gt;&lt;font face="Trebuchet MS"&gt;We have to populate InitializeComponent method with&amp;nbsp;following code..&lt;br&gt;&lt;br&gt;&amp;nbsp;&lt;/font&gt;&amp;nbsp;&amp;nbsp;private void InitializeComponent() &lt;h1&gt;&lt;/h1&gt;&amp;nbsp;&amp;nbsp;{ &lt;h1&gt;&lt;/h1&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller(); &lt;h1&gt;&lt;/h1&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller(); &lt;h1&gt;&lt;/h1&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;//  &lt;h1&gt;&lt;/h1&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;// serviceProcessInstaller1 &lt;h1&gt;&lt;/h1&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;//  &lt;h1&gt;&lt;/h1&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem; &lt;h1&gt;&lt;/h1&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.serviceProcessInstaller1.Password = null; &lt;h1&gt;&lt;/h1&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.serviceProcessInstaller1.Username = null; &lt;h1&gt;&lt;/h1&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;//  &lt;h1&gt;&lt;/h1&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;// serviceInstaller1 &lt;h1&gt;&lt;/h1&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;//  &lt;h1&gt;&lt;/h1&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.serviceInstaller1.DisplayName = "COMTestService"; &lt;h1&gt;&lt;/h1&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.serviceInstaller1.ServiceName = "COMTestService"; &lt;h1&gt;&lt;/h1&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;//  &lt;h1&gt;&lt;/h1&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;// ProjectInstaller &lt;h1&gt;&lt;/h1&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;//  &lt;h1&gt;&lt;/h1&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.Installers.AddRange( new System.Configuration.Install.Installer[] { &lt;h1&gt;&lt;/h1&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.serviceProcessInstaller1, &lt;h1&gt;&lt;/h1&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.serviceInstaller1} );&lt;/font&gt;&lt;/h1&gt; &lt;h1&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;}&lt;/font&gt;&lt;/h1&gt; &lt;h1&gt;&lt;font size="2"&gt;Now, the code should be okey and service should be able to install properly. &lt;/font&gt;&lt;font face="Courier New"&gt;&lt;/h1&gt;&lt;/font&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2399640" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jigarme/archive/tags/.NET/default.aspx">.NET</category></item><item><title>How to load the assemblies from disk apart from GAC and current directory?</title><link>http://blogs.msdn.com/jigarme/archive/2006/12/21/how-to-load-the-assemblies-from-disk-apart-from-gac-and-current-directory.aspx</link><pubDate>Wed, 20 Dec 2006 23:24:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1333534</guid><dc:creator>Jigar Mehta</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jigarme/comments/1333534.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jigarme/commentrss.aspx?PostID=1333534</wfw:commentRss><description>&lt;p&gt;Just came across this question and got to know about a method where we can get the assembly resolve event and load the assembly programatically from any directory / URL we want!&lt;/p&gt; &lt;p&gt;Following are the articles which talks more about this,&lt;/p&gt; &lt;ul&gt; &lt;li&gt; &lt;div class="MsoNormal"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Segoe UI'"&gt;&lt;a href="http://support.microsoft.com/kb/897297"&gt;&lt;font color="#0000ff"&gt;http://support.microsoft.com/kb/897297&lt;/font&gt;&lt;/a&gt;&lt;?xml:namespace prefix = o /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt; &lt;li&gt; &lt;div class="MsoNormal"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Segoe UI'"&gt;&lt;a href="http://support.microsoft.com/kb/837908"&gt;&lt;font color="#0000ff"&gt;http://support.microsoft.com/kb/837908&lt;/font&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Segoe UI'"&gt;Might be helpful in some situations.&lt;/span&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1333534" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jigarme/archive/tags/.NET/default.aspx">.NET</category></item><item><title>The order in which Assemblies are located by runtime!</title><link>http://blogs.msdn.com/jigarme/archive/2006/12/19/the-order-in-which-assemblies-are-located-by-runtime.aspx</link><pubDate>Mon, 18 Dec 2006 22:59:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1318124</guid><dc:creator>Jigar Mehta</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jigarme/comments/1318124.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jigarme/commentrss.aspx?PostID=1318124</wfw:commentRss><description>&lt;p&gt;Just came across this question, and did some research! This is the order.&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Configuration files&lt;/li&gt; &lt;ol&gt; &lt;li&gt;Application Configuration File&lt;/li&gt; &lt;li&gt;Publisher Policy File&lt;/li&gt; &lt;li&gt;Machine Configuration File.&lt;/li&gt;&lt;/ol&gt; &lt;li&gt;Check is made to see if the same assembly is loaded previously by any any other application.&lt;/li&gt; &lt;li&gt;Global Assembly Cache&lt;/li&gt; &lt;li&gt;Locating through &amp;lt;codebase&amp;gt; or &amp;lt;probing&amp;gt; in configuration file.&lt;/li&gt; &lt;ol&gt; &lt;li&gt;Probing with private path is done in following order,&lt;/li&gt;&lt;/ol&gt;&lt;/ol&gt; &lt;blockquote&gt; &lt;p&gt;&lt;strong&gt;Probing with the privatePath Attribute&lt;/strong&gt;&lt;/p&gt; &lt;p class="subSection"&gt;In addition to the culture subdirectories and the subdirectories named for the referenced assembly, the runtime also probes directories specified using the &lt;b&gt;privatePath&lt;/b&gt; attribute of the &lt;a onclick="javascript:Track('ctl00_LibFrame_ctl01|ctl00_LibFrame_ctl18',this);" href="http://msdn2.microsoft.com/en-us/library/823z9h8w.aspx"&gt;&lt;font color="#0000ff"&gt;&amp;lt;probing&amp;gt;&lt;/font&gt;&lt;/a&gt; element. The directories specified using the &lt;b&gt;privatePath&lt;/b&gt; attribute must be subdirectories of the application's root directory. The directories probed vary depending on whether culture information is included in the referenced assembly request. &lt;/p&gt; &lt;p class="subSection"&gt;The runtime stops probing the first time it finds an assembly that matches the simple assembly name referenced, whether it is a correct match or not. If it is a correct match, that assembly is used. If it is not a correct match, probing stops and binding fails.&lt;/p&gt; &lt;p class="subSection"&gt;If culture is included, the following directories are probed:&lt;/p&gt; &lt;p class="subSection"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;[application base] / [binpath] / [culture] / [assembly name].dll&lt;/p&gt; &lt;p class="subSection"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;[application base] / [binpath] / [culture] / [assembly name] / [assembly name].dll&lt;/p&gt; &lt;p class="subSection"&gt;If culture information is not included, the following directories are probed:&lt;/p&gt; &lt;p class="subSection"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;[application base] / [binpath] / [assembly name].dll&lt;/p&gt; &lt;p class="subSection"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;[application base] / [binpath] / [assembly name] / [assembly name].dll&lt;/p&gt;&lt;/blockquote&gt; &lt;blockquote&gt; &lt;p&gt;&lt;strong&gt;Probing the Application Base and Culture Directories&lt;/strong&gt;&lt;/p&gt; &lt;div class="subSection"&gt; &lt;p&gt;The runtime always begins probing in the application's base, which can be either a URL or the application's root directory on a computer. If the referenced assembly is not found in the application base and no culture information is provided, the runtime searches any subdirectories with the assembly name. The directories probed include:&lt;/p&gt; &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;[application base] / [assembly name].dll&lt;/p&gt; &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;[application base] / [assembly name] / [assembly name].dll&lt;/p&gt; &lt;p&gt;If culture information is specified for the referenced assembly, only the following directories are probed:&lt;/p&gt; &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;[application base] / [culture] / [assembly name].dll&lt;/p&gt; &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;[application base] / [culture] / [assembly name] / [assembly name].dll&lt;/p&gt;&lt;/div&gt;&lt;/blockquote&gt; &lt;p&gt;Apart from this, something I could find was, if we have chain of depend. we can load all second-level depend., from first dependency file location.&lt;/p&gt; &lt;p&gt;For example, if Assembly1 references Assembly2 and Assembly1 was downloaded from http://www.code.microsoft.com/utils, that location is considered to be a hint about where to find Assembly2.dll. The runtime then probes for the assembly in,&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.code.microsoft.com/utils/Assembly2.dll"&gt;http://www.code.microsoft.com/utils/Assembly2.dll&lt;/a&gt; and &lt;a href="http://www.code.microsoft.com/utils/Assembly2/Assembly2.dll"&gt;http://www.code.microsoft.com/utils/Assembly2/Assembly2.dll&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1318124" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jigarme/archive/tags/.NET/default.aspx">.NET</category></item><item><title>How to load the assembly from location different from the application path or any of its subdirectories!</title><link>http://blogs.msdn.com/jigarme/archive/2006/11/08/how-to-load-the-assembly-from-location-different-from-the-application-path-or-any-of-its-subdirectories.aspx</link><pubDate>Wed, 08 Nov 2006 20:48:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1038166</guid><dc:creator>Jigar Mehta</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jigarme/comments/1038166.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jigarme/commentrss.aspx?PostID=1038166</wfw:commentRss><description>&lt;P&gt;Just got a case where customer needed to load C# Assembly from location which is not in the hierarchy of the application path nor is that in the GAC. The application which loads the assembly is a C++ native application using interop.&lt;/P&gt;
&lt;P&gt;After searching a lot and trying a bit, could find a KB article which states about it.&lt;BR&gt;&lt;A href="http://support.microsoft.com/kb/897297"&gt;&lt;FONT color=#003399&gt;http://support.microsoft.com/kb/897297&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The solution is, to genrate the configuration file for the C++ executable in the application path. My sample application had the architecture as follows,&lt;/P&gt;
&lt;P&gt;C++ native application ----&amp;gt; C# assembly (namespace: CSharpLibrary)&amp;nbsp;--&amp;gt; Another C# assembly (namespace: CSharpLibraryParent)&lt;BR&gt;[Note: Arrow means "uses"]&lt;/P&gt;
&lt;P&gt;So, as it involves the interop, I regasm the first C# assembly with /codebase and /tlb option and compiled my C++ native application. But to replicate the scenario, wanted put the last assembly named CSharpLibraryParent&amp;nbsp;in "c:\New Folder" and make it work. So, in this scenario, my configuration file showed up like following,&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;lt;configuration&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;lt;runtime&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;dependentAssembly&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;assemblyIdentity name="CSharpLibrary" culture="neutral" publicKeyToken="d091f52b0033dd95"/&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;codeBase version="1.0.0.0" href="&lt;A href="file:///D:/Jigar/CSharpLibrary/CSharpLibrary.dll%22/"&gt;&lt;FONT color=#003399&gt;FILE://D:/Jigar/CSharpLibrary/CSharpLibrary.dll"/&lt;/FONT&gt;&lt;/A&gt;&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/dependentAssembly&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;dependentAssembly&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;assemblyIdentity name="CSharpLibraryParent" culture="neutral" publicKeyToken="e87b16e3407e53b1"/&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;codeBase version="1.0.0.0" href="&lt;A href="file:///C:/New"&gt;&lt;FONT color=#003399&gt;FILE://C:/New&lt;/FONT&gt;&lt;/A&gt; Folder/CSharpLibraryParent.dll"/&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/dependentAssembly&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/assemblyBinding&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;lt;/runtime&amp;gt;&lt;BR&gt;&amp;lt;/configuration&amp;gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1038166" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jigarme/archive/tags/.NET/default.aspx">.NET</category></item><item><title>COM-.NET Interop development? Take care of this thing.</title><link>http://blogs.msdn.com/jigarme/archive/2006/10/13/com-net-interop-development-take-care-of-this-thing.aspx</link><pubDate>Fri, 13 Oct 2006 17:42:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:822173</guid><dc:creator>Jigar Mehta</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jigarme/comments/822173.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jigarme/commentrss.aspx?PostID=822173</wfw:commentRss><description>&lt;p&gt;&lt;/p&gt; &lt;p&gt;I was trying my hands at creating a .NET 2.0 component that can be consumed by a COM application. &lt;br&gt;One of the errors I got in the process of registering the .NET assembly was &lt;br&gt;RegAsm : warning RA0000 : No types were registered.  &lt;p&gt;This was baffling!! I had done everything right and spent quite some time figuring out what could have gone wrong... until I had a look at the AssemblyInfo.cs. The ComVisible property for the assembly was set to false!! Or the other option would be make all classes and interfaces in your assembly as ComVisible by using ComVisibleAttribute. To access types in a .NET assembly from COM, this property should be set to true. Once I did it, I was able to successfully register the .NET assembly and consume it in my COM component. Be sure to remember this when developing COM - .NET interop applications!! &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=822173" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jigarme/archive/tags/Interop/default.aspx">Interop</category><category domain="http://blogs.msdn.com/jigarme/archive/tags/.NET/default.aspx">.NET</category></item></channel></rss>