Author: Sreedhar Koganti In my Previous article we saw how to Create a package ,Delete Package. In this article will see how to Add Dll’s into package. As i said in my previous article you can try these examples in ASP and VB. Personally I will prefer to write in VB. If you want to Create Install/Uninstall package for COM+ dll always writing in VB is preferable. To do this in VB first you have to refer the Com+ admin type library(comadmin.dll). This Comadmin.dll has several classes. Here i am using COMAdmin.COMAdminCatalog. We discussed about comadmincatalogcollecion in my previous article. Inorder to Install Com+ Dll first we need to know into which package we wanto install, which dll we wanto install. Here i am trying to install dll in "SamplePackage" Package. For that i am using "Test.dll" To install this we have to us InstallComponent porperty from COMAdminCatalog In Below example I tried to install Test.dll into "SamplePackage". This example you can get form downloads. It's in VB. (use this code in VB sub or Function or in asp) Private Sub DllInstall_Click() On Error GoTo errloop Dim objCOM As COMAdmin.COMAdminCatalog Set objCOM = CreateObject("COMAdmin.COMAdminCatalog") 'below Code explains to add the component to App objCOM.InstallComponent "SamplePackage", "Test.dll", "", "" Set objCOM = Nothing MsgBox "your Dll is Successfully installed in" & cmbApp.Text & "Package" Exit Sub errloop: MsgBox "Please Select a package name / enter the Dll Name with Path", vbInformation, "Installer Information" Err.Clear End Sub
The above code will Install the Test.dll into SamplePackage. InstallComponent method will take four parameters. The first parameter is the application key, and the second one is the file name (DLL), third is external type library (if any), and the last parameter is the name of the proxy-stub DLL name (if any). Uninstall The Dll From The Package: Dim COMObject As COMAdmin.COMAdminCatalog Dim AdminCatCol As COMAdminCatalogCollection Dim AdminCatColOne As COMAdminCatalogCollection Dim AdminCatObj As COMAdminCatalogObject Dim ComCountColl As Integer Dim blnFound As Boolean Dim Comp As String Comp = InStr(Text1.Text, ".") Comp = Left(Text1, Comp) RemoveComponent = False Set COMObject = CreateObject("COMAdmin.COMAdminCatalog") Set AdminCatCol = COMObject.GetCollection("Applications") AdminCatCol.Populate Found = False 'Iterate through Collection For Each AdminCatObj In AdminCatCol 'Assign Component Collection to AdminCatColOne Set AdminCatColOne = AdminCatCol.GetCollection("Components", AdminCatObj.Key) AdminCatColOne.Populate 'Iterate through Collection If AdminCatColOne.Count = 0 Then GoTo Loopone For ComCountColl = AdminCatColOne.Count - 1 To 0 Step -1 'Check the Name in the Collection If InStr(UCase(AdminCatColOne.Item(ComCountColl).Name), UCase(Comp)) > 0 Then 'If the name matches Make RemoveEnable to true If AdminCatColOne.RemoveEnabled = True Then blnFound = True COMObject.ShutdownApplication AdminCatObj.Key AdminCatColOne.Remove ComCountColl AdminCatColOne.SaveChanges Else MsgBox "RemoveEnabled property returned false" End If End If Next Loopone: If blnFound = True Then Exit For Next If blnFound Then MsgBox "Component Removed Successfully" Else MsgBox "Unable to find the Dll ....(Please Dont' enter the Path)" End If If blnFound = True Then RemoveComponent = True Set AdminCatObj = Nothing Set AdminCatCol = Nothing Set COMObject = Nothing
********************************************************** To Uninstall the dll from the COM+ , actuall way is First we have to find the KeyID of the dll then we have to check for the Key id in all the packages.If you find Id then delete it. But here i followed round about method by keeping basic reades in my mind. Reades can understand this approch very easily even though they doesend knwo about KEY. Here in my first step i am accepting the dll name from the text box.Then i am taking only name part from the text box. Ex: fi i have dll name as FileProc.dll, From this i am taking "Fileproc." , and i am checking for "FileProc." To do this I am taking All the Applications names as collection into "AdminCatCol". Again From each Application i am taking Component Collection. From the Component collection i am taking each class of the component and i am comparing with the entered dll name. If it is there then i am removing the class form that collecton and i am saving the collection. Once you see the code You can get clear idea.You can down the code from downloads. You can get more information on this in http://msdn.microsoft.com. By making some changes in the above code and keeping more error trapping you can create Make good Install Package. Note: In this example i am not checking whether the dll is installed Previouslly or not. I am installing the specified dll if it is there or not. You can add that code to make better installer package. Note: This code can also be implemented in ASP with some changes. It will help people who want to deploy COM+ dll with out manual process. Author: Sreedhar Koganti Working in Unisys as a Technical Team Lead Expertixe in ASP,COM+,XML,SOAP,NTService,VB, Drop of .Net Article Writer in asptoday.com,Aspalliance.com,aspfree.com | DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |
More ASP Code Articles More By Sreedhar Koganti developerWorks - FREE Tools! | <a href="http://zeus.developershed.com/shonuff.php?blackbird=3853&zoneid=442&source=&dest=http%3A%2F%2Fwww.ibm.com%2Fdeveloperworks%2Fspaces%2Fjazz%3FS_TACT%3D105AGY31%26S_CMP%3DDEVSHED&ismap="><img src="http://images.devshed.com/corp/img/news/jazz01.gif" alt="developerWorks Jazz space" align="left"></a>You've heard the buzz about Jazz... want to know more about it from a developer's perspective? Check out the Jazz space on developerWorks. This space is an up-to-date resource for developers, including technical information about Jazz and products built on Jazz, like Rational Team Concert Express. The Jazz space includes content from a wide variety of sources, including links, feeds, and comments from experts. FREE! Go There Now!
| | | | The IBM DB2 Deep Compression ROI tool is designed for DBA’s and IT management personnel to perform a clinical analysis of the cost savings gained from the Storage Optimization feature of DB2 9 for Linux, UNIX and Windows. The feature, also known as Deep Compression, compresses data that lies within a database by up to 80% at times. FREE! Go There Now!
| | | | Learn field-tested SOA principles, methodology, technology and implementation from the global SOA market leader - in a new e-book by an IBM SOA expert. Written by IBM Certified SOA Solution Designer Bobby Woolf, "Exploring IBM SOA Technology & Practice" is the ultimate insider's guide to SOA - a PDF e-book packed cover to cover with IBM's specific advice on how to make your SOA implementation a success. FREE! Go There Now!
| | | | Download a free trial version of IBM DB2 9.5 for Linux, UNIX, and Windows. DB2 9 is the result of a five-year development project that transformed traditional (static) database technology into an interactive data server that merges the high performance and ease of use of DB2 with the self-describing benefits of XML. FREE! Go There Now!
| | | | Visit IBM developerWorks to download a free trial of the Rational Host Access Transformation Services (HATS) Toolkit. The HATS toolkit provides a set of plug-ins for the IBM Rational Software Delivery Platform to help you easily extend your legacy applications. HATS makes your 3270 and 5250 applications available as HTML through the most popular Web browsers, while converting your host screens to a Web look and feel and it also enables you to develop new Web, portal, and rich-client applications. FREE! Go There Now!
| | | | Analysts, architects, and developers who have existing COBOL or PL/I skills and want to extend those skills to deploy new workloads on the mainframe can use the IBM Enterprise Modernization Sandbox for System z to find hands-on walkthroughs of common real world scenarios. The scenarios provide examples of how to rapidly design, create, assemble, test, and deploy high-quality Web, Web services, portal, and SOA applications for IBM CICS, IBM IMS, and IBM WebSphere Application Server. FREE! Go There Now!
| | | | Listen to this webcast to get an overview of Info 2.0 and a technical demo of how to quickly build an enterprise mashup. IBM's Info 2.0 technology leverages emerging Web 2.0 technologies such as mashups, feeds, AJAX, and JSON in order to simplify assembly of information using feeds and services. Come learn about the technical elements of Info 2.0 including the Feed Generation framework, Mashup Engine, and mashup assembly components. Learn how to pull information from databases, departmental information, and the Web to create mashups critical to your company’s success. We will also discuss best practices to help you get started. FREE! Go There Now!
| | | | XML has become a common way of storing business data as flat files and many data server vendors including IBM have provided ways to store this data within relational database systems. Increasingly collections of XML files are accessed like databases using an xQuery and other XML standard mechanisms. Businesses find the need to combine the traditional tabular structured data with XML formatted data. In this webcast, you’ll learn about IBM’s WebSphere Federation Server technology, which provides users with the ability to integrate these two data formats. FREE! Go There Now!
| | | | This Fall, IBM Rational talks to you directly through a special teleconference series giving you access to the best minds in IBM Rational - product experts and market thought leaders who will answer your questions during these pre-scheduled telephone conference calls. Register today! FREE! Go There Now!
| | | | IBM Lotus Notes 8 provides a wide range of developers the ability to provide customized, integrated user interfaces via composite applications and via custom sidebar and toolbar plug-ins. This webcast provides you with tips and techniques to use with out-of-the-box capabilities of Lotus Notes 8, and survey how you can share useful components within your own company and within a larger community. FREE! Go There Now!
| | | | All FREE IBM® developerWorks Tools! | |