|
| 1 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | +<html xmlns:mshelp="http://msdn.microsoft.com/mshelp"> |
| 3 | +<head> |
| 4 | + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| 5 | + <meta content="history" name="save"> |
| 6 | + <title>Deploying Interop User Controls</title> |
| 7 | + <link rel="stylesheet" type="text/css" href="../stylesheets/helpstudio.css"> |
| 8 | + <link rel="stylesheet" type="text/css" href="../stylesheets/MSDN.css"> |
| 9 | + <link rel="stylesheet" type="text/css" href="../stylesheets/tree.css"> |
| 10 | + <style type="text/css"> |
| 11 | + div#pagetop, div#pagetop table td, span#projecttitle, span#pagetitle |
| 12 | + { |
| 13 | + background-color: #90C8FF; |
| 14 | + color: #000080; |
| 15 | + } |
| 16 | + </style> |
| 17 | + <xml> |
| 18 | + <MSHelp:RLTitle Title="Structuring the Migration Process"/> |
| 19 | + <MSHelp:Attr Name="DocSet" Value="InteropFormToolkit2.0"/> |
| 20 | + <MSHelp:Attr Name="TopicType" Value="kbRef"/> |
| 21 | + <MSHelp:Attr Name="DevLang" Value="VB"/> |
| 22 | + <MSHelp:Keyword Index="F" Term="MicrosoftInteropFormToolkitIntroduction"/> |
| 23 | + </xml> |
| 24 | +</head> |
| 25 | +<body> |
| 26 | + <div id="pagetop"> |
| 27 | + <table width="100%" id="pagetoptable1"> |
| 28 | + <tr id="pagetoptable1row1"> |
| 29 | + <td align="left"> |
| 30 | + <span id="projecttitle">Interop Forms Toolkit </span> |
| 31 | + </td> |
| 32 | + <td align="right"> |
| 33 | + <span id="feedbacklink"> |
| 34 | + </td> |
| 35 | + </span> </td> |
| 36 | + </tr> |
| 37 | + <tr id="pagetoptable1row2"> |
| 38 | + <td align="left" colspan="2"> |
| 39 | + <span id="pagetitle">Deploying Interop User Controls </span> |
| 40 | + </td> |
| 41 | + </tr> |
| 42 | + </table> |
| 43 | + </div> |
| 44 | + <div id="mainbody"> |
| 45 | +<p>As with InteropForm assembles, Interop UserControls must be registered on |
| 46 | +the client computer. You can deploy them using the same techniques described in |
| 47 | +the topic <a href="Hybrid%20Application%20Deployment.html">Hybrid Application |
| 48 | +Deployment</a>, or if you are deploying to computers running Windows XP or |
| 49 | +later, you can deploy them side-by-side using the techniques described later in |
| 50 | +the topic.</p> |
| 51 | +<p>For an example of deploying with a Visual Studio .NET Setup and Deployment |
| 52 | +project, see <a href="../How To/How To Deploy A Hybrid Application.html">How |
| 53 | +To: Deploy a Hybrid Application</a>.</p> |
| 54 | +<blockquote dir="ltr" style="MARGIN-RIGHT: 0px"> |
| 55 | + <p><strong>Note:</strong> In most cases it is easier to deploy |
| 56 | + using the methods described in <a href= |
| 57 | + "../How To/How To Deploy A Hybrid Application.html">How To: Deploy a Hybrid |
| 58 | + Application</a>. Deploying with Reg-Free COM requires more effort, but |
| 59 | + works best when you want to have a minimal impact to your existing setup |
| 60 | + package (i.e. a Setup created using the Package & Deployment Wizard). |
| 61 | + Since no additional registry entries are required, deploying your new |
| 62 | + application is as simple as updating your package to copy the new .NET |
| 63 | + .dlls and .manifest file to the application folder.</p> |
| 64 | +</blockquote> |
| 65 | +<p><strong>Deploying Side-by-side with Reg-Free COM</strong></p> |
| 66 | +<p>Windows XP provides a mechanism known as Reg-Free COM for deploying COM |
| 67 | +objects without requiring registry entries. This allows you to deploy Interop |
| 68 | +UserControls as .dll files that install in the same directory as your |
| 69 | +application .exe. If you include a .manifest file in the application directory, |
| 70 | +the .exe can find and use the Interop UserControl even though it is not |
| 71 | +registered as a COM object. This also allows you to deploy your Visual Basic |
| 72 | +6.0 application using the newer ClickOnce deployment technology, which does not |
| 73 | +support COM registration.</p> |
| 74 | +<p><strong>Note </strong> The Interop UserControl will still need to |
| 75 | +registered on the development machine, since Visual Basic 6.0 pre-dates |
| 76 | +Reg-Free COM.</p> |
| 77 | +<p>In order to deploy your Interop UserControl with Reg-Free COM, you will need |
| 78 | +both a client manifest (for the application) and a private assembly manifest |
| 79 | +(for the UserControl). The private assembly manifest is automatically generated |
| 80 | +by the Visual Basic 6.0 Interop UserControl template, but you need to create |
| 81 | +the client manifest yourself and add it to your Visual Basic 6.0 application |
| 82 | +directory.</p> |
| 83 | +<p>You can create the manifest file in the XML editor in Visual Studio .NET, or |
| 84 | +you can create it using a text editor such as Notepad. The following is an |
| 85 | +example of a client manifest:</p> |
| 86 | +<p><font face="Courier New"><?xml version="1.0" encoding="UTF-8" |
| 87 | +standalone="yes"?><br> |
| 88 | +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" |
| 89 | +manifestVersion="1.0"><br> |
| 90 | + <assemblyIdentity type="win32" name="<em>MyApp</em>" |
| 91 | +version="1.0.0.0" processorArchitecture="x86" /><br> |
| 92 | + <dependency><br> |
| 93 | + |
| 94 | +<dependentAssembly><br> |
| 95 | + |
| 96 | +<assemblyIdentity type="win32" name="<em>MyUserControl</em>" |
| 97 | +version="1.0.0.0" /><br> |
| 98 | + |
| 99 | +</dependentAssembly><br> |
| 100 | + </dependency><br> |
| 101 | +</assembly></font></p> |
| 102 | +<p>The name "<em>MyApp</em>" should be replaced by the name of your Visual |
| 103 | +Basic 6.0 .exe, and the name "<em>MyUserControl</em>" should be replaced by the |
| 104 | +name of your Interop UserControl .dll; the .exe and .dll extensions should not |
| 105 | +be included. In addition, the version numbers should be updated to match |
| 106 | +the versions of your .exe and .dll.</p> |
| 107 | +<p>The manifest file must be named <em>MyApp</em>.exe.manifest, where |
| 108 | +<em>MyApp</em> is the name of your Visual Basic 6.0 .exe. During deployment, |
| 109 | +the .exe, the client manifest, and the .dll must all be installed to the same |
| 110 | +directory on the client computer. When the application loads, Windows inspects |
| 111 | +the manifest and determines that the application uses Reg-Free COM, and then |
| 112 | +loads the .dll from the specified location.</p> |
| 113 | +<p><strong>Private Assembly Manifest</strong></p> |
| 114 | +<p>The Visual Basic 6.0 Interop UserControl template creates a private |
| 115 | +assembly manifest for your control named InteropUserControl.manifest. In most |
| 116 | +case you will never need to touch this file, but if you make changes to the |
| 117 | +name of the project or the class you will need to update the manifest to |
| 118 | +reflect your changes. You will also need to update this file if you add more |
| 119 | +than one Interop UserControl to your project (the first |
| 120 | +<strong>clrClass</strong> entry is automatically filled in, but additional ones |
| 121 | +must be added manually). The following is an example of a private assembly |
| 122 | +manifest; the italicized elements are the ones that might need to be |
| 123 | +changed:</p> |
| 124 | +<p><font face="Courier New"><?xml version="1.0" encoding="UTF-8" |
| 125 | +standalone="yes"?><br> |
| 126 | +<!-- You don't need to worry about anything in this file unless you're<br> |
| 127 | + using Reg-free COM. --><br> |
| 128 | +<assembly xmlns="urn:schemas-microsoft-com:asm.v1"<br> |
| 129 | + manifestVersion="1.0"><br> |
| 130 | +<assemblyIdentity<br> |
| 131 | + |
| 132 | +type="win32"<br> |
| 133 | + |
| 134 | +name="<em>MyUserControl</em>"<br> |
| 135 | + |
| 136 | +version="1.0.0.0" /><br> |
| 137 | + <clrClass</font></p> |
| 138 | +<p><font face= |
| 139 | +"Courier New"> clsid="<em> |
| 140 | +{Insert GUID here}</em>"</font></p> |
| 141 | +<p><font face= |
| 142 | +"Courier New"> |
| 143 | +progid="<em>MyUserControl.MyUserControlClass</em>"</font></p> |
| 144 | +<p><font face= |
| 145 | +"Courier New"> |
| 146 | +threadingModel="Both"</font></p> |
| 147 | +<p><font face= |
| 148 | +"Courier New"> name="<em> |
| 149 | +MyUserControl.MyUserControlClass</em>" ></font></p> |
| 150 | +<p><font face="Courier New"> |
| 151 | +</clrClass></font></p> |
| 152 | +<p><font face="Courier New"> |
| 153 | +<clrClass</font></p> |
| 154 | +<p><font face= |
| 155 | +"Courier New"> clsid="<em> |
| 156 | +{Insert GUID here}</em>"</font></p> |
| 157 | +<p><font face= |
| 158 | +"Courier New"> |
| 159 | +progid="<em>MyUserControl.SecondUserControlClass</em>"</font></p> |
| 160 | +<p><font face= |
| 161 | +"Courier New"> |
| 162 | +threadingModel="Both"</font></p> |
| 163 | +<p><font face= |
| 164 | +"Courier New"> name="<em> |
| 165 | +MyUserControl.SecondUserControlClass</em>" ></font></p> |
| 166 | +<p><font face="Courier New"> |
| 167 | +</clrClass></font><br> |
| 168 | +</assembly></p> |
| 169 | +<p>In the above example, the value for clsid would be |
| 170 | +the ClassID found in your COM registration section of the |
| 171 | +<em>UserControl</em>.vb file. For progid and name, |
| 172 | +<em>MyUserControl</em> would be the name of your UserControl assembly, |
| 173 | +and <em>MyUserControlClass</em> would be the name of your |
| 174 | +UserControl class. To add multiple UserControls in a single assembly, add a |
| 175 | +<clrClass> element for each UserControl.</p> |
| 176 | +<p>In addition, there is a hidden file named InteropUserControl.rc that must be |
| 177 | +updated when you change the project or class name. You can view this file in |
| 178 | +Solution Explorer by choosing Show All Files. The following is an example of |
| 179 | +the .rc file; the italicized elements are the ones that might need to be |
| 180 | +changed:</p> |
| 181 | +<p><font face="Courier New">#define RT_MANIFEST 24</font></p> |
| 182 | +<p><font face="Courier New">1 RT_MANIFEST |
| 183 | +<em>MyUserControl</em>.manifest</font></p> |
| 184 | +<p><font face="Courier New">101 BITMAP <em>MyUserControl</em>.bmp</font></p> |
| 185 | +<p><font face="Courier New"><font face="Verdana">For more information |
| 186 | +about Reg-Free COM, see <a href= |
| 187 | +"http://msdn2.microsoft.com/en-us/library/eew13bza.aspx">How to: Configure .NET |
| 188 | +Components for Registration-Free Activation</a>.</font></font></p> |
| 189 | + </div> |
| 190 | + <div id="pagefooter"> |
| 191 | + <p> |
| 192 | + </p> |
| 193 | + <p> |
| 194 | + </p> |
| 195 | + <hr size="1"> |
| 196 | + <p> |
| 197 | + Copyright © by Microsoft Corporation. All Rights Reserved. |
| 198 | + </p> |
| 199 | + </div> |
| 200 | +</body> |
| 201 | +</html> |
0 commit comments