{"id":2043,"date":"2006-09-20T19:30:00","date_gmt":"2006-09-20T19:30:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/heaths\/2006\/09\/20\/installing-assemblies-for-runtime-and-design-time-use\/"},"modified":"2006-09-20T19:30:00","modified_gmt":"2006-09-20T19:30:00","slug":"installing-assemblies-for-runtime-and-design-time-use","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/setup\/installing-assemblies-for-runtime-and-design-time-use\/","title":{"rendered":"Installing Assemblies for Runtime and Design-time Use"},"content":{"rendered":"<p>The Microsoft .NET Framework installs assemblies into two different locations, and this practice is recommended to developers wishing to deploy assemblies both for runtime and design-time use. <\/p>\n<p>Runtime assemblies are those assemblies needed for an application to execute. It is recommended that you add runtime assemblies to the <a href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/yf1d93sz.aspx\">Global Assembly Cache<\/a> (GAC). If you&#8217;re deploying your assemblies in a Windows Installer package, you would add the file normally but then add records into the <a href=\"http:\/\/msdn.microsoft.com\/library\/en-us\/msi\/setup\/msiassembly_table.asp\">MsiAssembly<\/a> and <a href=\"http:\/\/msdn.microsoft.com\/library\/en-us\/msi\/setup\/msiassemblyname_table.asp\">MsiAsemblyName<\/a> tables. If you plan on doing <a href=\"http:\/\/blogs.msdn.com\/heaths\/archive\/2005\/06\/10\/427803.aspx\">in-place updates<\/a> &ndash; though <a href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/51ket42z.aspx\">assembly versioning<\/a> is recommended &ndash; be sure to add the FileVersion attribute to the MsiAssemblyName table. <\/p>\n<p>Design-time assemblies are those assemblies you would compile and link against when building your own managed assemblies. In Visual Studio, these are assemblies you would see when you right-click on a project, for example, and click &#8220;Add References&#8230;&#8221;. These assemblies are installed as any other normal files would be installed using Windows Installer, with the addition of a registry key under SOFTWAREMicrosoft.NETFrameworkAssemblyFolders &ndash; either under HKEY_LOCAL_MACHINE for all users, or HKEY_CURRENT_USER for the current user. <\/p>\n<p>Since the .NET Framework provides the <a href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/ms229335.aspx\">base class library<\/a>, all the assemblies are co-installed into both locations. Components from other vendors may also do the same, while end user applications may install only into the GAC. Developers really should only install design-time assemblies they want users to reference in their own projects. These assemblies will certainly work with dependent assemblies installed only into the GAC. <\/p>\n<p>An example WIX fragment follows. This was updated from the previous snippet to pass ICE30 validation and add the Assembly attribute that was mistakenly left out originally. Thanks to <a href=\"http:\/\/blogs.msdn.com\/astebner\/\">Aaron Stebner<\/a> for pointing this out. <\/p>\n<p><span><span>&lt;<\/span><span>Directory<\/span><span> <\/span><span>Id<\/span><span>=<\/span>&#8220;<span>ProgramFilesFolder<\/span>&#8220;<span>&gt; <\/span><\/span><\/p>\n<p><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&lt;<\/span><span>Directory<\/span><span> <\/span><span>Id<\/span><span>=<\/span>&#8220;<span>ProductDirectory<\/span>&#8220;<span> <\/span><span>Name<\/span><span>=<\/span>&#8220;<span>$(var.ProductName)<\/span>&#8220;<span>&gt; <\/span><\/span><\/p>\n<p><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;<\/span><span>Directory<\/span><span> <\/span><span>Id<\/span><span>=<\/span>&#8220;<span>GAC<\/span>&#8220;<span> <\/span><span>Name<\/span><span>=<\/span>&#8220;<span>GAC<\/span>&#8220;<span>&gt; <\/span><\/span><\/p>\n<p><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;<\/span><span>Component<\/span><span> <\/span><span>Id<\/span><span>=<\/span>&#8220;<span>RT_MyControl<\/span>&#8220;<span> <\/span><span>Guid<\/span><span>=<\/span>&#8220;<span>22887611-B13E-41EE-897C-D78830E68AEB<\/span>&#8220;<span> <\/span><span>DiskId<\/span><span>=<\/span>&#8220;<span>1<\/span>&#8220;<span>&gt; <\/span><\/span><\/p>\n<p><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;!&#8211;<\/span><span> Runtime, assembly in GAC <\/span><span>&#8211;&gt; <\/span><\/span><\/p>\n<p><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;<\/span><span>File<\/span><span> <\/span><span>Id<\/span><span>=<\/span>&#8220;<span>F_RT_MyControl<\/span>&#8220;<span> <\/span><span>Name<\/span><span>=<\/span>&#8220;<span>MyCtrl.dll<\/span>&#8220;<span> <\/span><span>LongName<\/span><span>=<\/span>&#8220;<span>MyControl.dll<\/span>&#8220;<span> <\/span><span>Source<\/span><span>=<\/span>&#8220;<span>$(var.SrcPath)MyControl.dll<\/span>&#8220;<span> <\/span><span>KeyPath<\/span><span>=<\/span>&#8220;<span>yes<\/span>&#8220;<span> <\/span><span>Assembly<\/span><span>=<\/span>&#8220;<span>.net<\/span>&#8220;<span>\/&gt; <\/span><\/span><\/p>\n<p><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/<\/span><span>Component<\/span><span>&gt; <\/span><\/span><\/p>\n<p><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/<\/span><span>Directory<\/span><span>&gt; <\/span><\/span><\/p>\n<p><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;<\/span><span>Component<\/span><span> <\/span><span>Id<\/span><span>=<\/span>&#8220;<span>DT_MyControl<\/span>&#8220;<span> <\/span><span>Guid<\/span><span>=<\/span>&#8220;<span>FB935B7D-D2BD-4B83-A26C-A9376EBA0915<\/span>&#8220;<span> <\/span><span>DiskId<\/span><span>=<\/span>&#8220;<span>1<\/span>&#8220;<span>&gt; <\/span><\/span><\/p>\n<p><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;!&#8211;<\/span><span> Design-time, private assembly <\/span><span>&#8211;&gt; <\/span><\/span><\/p>\n<p><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp;nbsp\n;&lt;<\/span><span>File<\/span><span> <\/span><span>Id<\/span><span>=<\/span>&#8220;<span>F_DT_MyControl<\/span>&#8220;<span> <\/span><span>Name<\/span><span>=<\/span>&#8220;<span>MyCtrl.dll<\/span>&#8220;<span> <\/span><span>LongName<\/span><span>=<\/span>&#8220;<span>MyControl.dll<\/span>&#8220;<span> <\/span><span>Source<\/span><span>=<\/span>&#8220;<span>$(var.SrcPath)MyControl.dll<\/span>&#8220;<span> <\/span><span>KeyPath<\/span><span>=<\/span>&#8220;<span>yes<\/span>&#8220;<span>\/&gt; <\/span><\/span><\/p>\n<p><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;<\/span><span>Registry<\/span><span> <\/span><span>Id<\/span><span>=<\/span>&#8220;<span>R_DT_MyControl_AssemblyFolders<\/span>&#8220;<span> <\/span><span>Root<\/span><span>=<\/span>&#8220;<span>HKLM<\/span>&#8220;<span> <\/span><span>Key<\/span><span>=<\/span>&#8220;<span>SOFTWAREMicrosoft.NETFrameworkAssemblyFolders[ProductName]<\/span>&#8220;<span> <\/span><span>Value<\/span><span>=<\/span>&#8220;<span>[$DT_MyControl]<\/span>&#8220;<span> <\/span><span>Type<\/span><span>=<\/span>&#8220;<span>string<\/span>&#8220;<span>\/&gt; <\/span><\/span><\/p>\n<p><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/<\/span><span>Component<\/span><span>&gt; <\/span><\/span><\/p>\n<p><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/<\/span><span>Directory<\/span><span>&gt; <\/span><\/span><\/p>\n<p><span><span>&lt;\/<\/span><span>Directory<\/span><span>&gt;<\/span><\/span><\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Microsoft .NET Framework installs assemblies into two different locations, and this practice is recommended to developers wishing to deploy assemblies both for runtime and design-time use. Runtime assemblies are those assemblies needed for an application to execute. It is recommended that you add runtime assemblies to the Global Assembly Cache (GAC). If you&#8217;re deploying [&hellip;]<\/p>\n","protected":false},"author":389,"featured_media":3843,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[20,64],"class_list":["post-2043","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-installation","tag-wix"],"acf":[],"blog_post_summary":"<p>The Microsoft .NET Framework installs assemblies into two different locations, and this practice is recommended to developers wishing to deploy assemblies both for runtime and design-time use. Runtime assemblies are those assemblies needed for an application to execute. It is recommended that you add runtime assemblies to the Global Assembly Cache (GAC). If you&#8217;re deploying [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/posts\/2043","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/users\/389"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/comments?post=2043"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/posts\/2043\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/media\/3843"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/media?parent=2043"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/categories?post=2043"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/tags?post=2043"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}