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! | You probably have thousands of lines of COBOL code loaded with business intelligence and being used to run your business, along with an army of developers maintaining these applications. Learn how to prepare your applications and developers so you can keep that competitive edge and move to a service-oriented architecture with the IBM Rational Enterprise Modernization solutions. Replay is available for 9 months. FREE! Go There Now!
| | | | This tutorial shows new users of IBM WebSphere Business Monitor Version 6.0.2 how to perform the "Hello World" equivalent for monitoring business process applications. It is intended to help you get familiar with the capabilities of the product. FREE! Go There Now!
| | | | Secure your Web applications with IBM Rational AppScan Standard Edition V7.7, previously known as Watchfire AppScan. This Web application security testing tool automates vulnerability assessments and scans and tests for common Web application vulnerabilities. Visit IBM developerWorks to download a free trial of IBM Rational AppScan Standard Edition V7.7. FREE! Go There Now!
| | | | As systems increase in complexity, communication between systems and software teams becomes more and more difficult. Now, there’s a way to improve product quality and communication.<br />Read the “Model Driven Systems Development” white paper to see how. Also included in this kit are more educational white papers, customer examples, tutorials, informative Webcasts, and best practices for designing, building and managing systems.<br /> FREE! Go There Now!
| | | | Learn how to implement a build management system that uses and extends your existing automation technologies. This tutorial shows, step-by-step, how to install and configure IBM Rational Build Forge to manage builds for Jakarta Tomcat from source code. FREE! Go There Now!
| | | | This paper is about the critical role that a discipline called integrated requirements management can play in helping to ensure that your business goals and IT investments are continuously aligned—whether you are sourcing, integrating, building or maintaining software. It also looks at ways that automated IBM Rational® products can work together to help you use requirements in the very best way. FREE! Go There Now!
| | | | Informix Dynamic Server (IDS) Express Edition offers outstanding online transaction processing (OLTP) database performance, while helping to simplify and automate many of the tasks associated with deploying databases for small business applications. IDS 11 further extends the ease of management and applications integration with the Admin API and Scheduler, high availability with Continuous Log Restore for backup server recovery in case of a primary server failure, and column level encryption to protect personal and company private data. FREE! Go There Now!
| | | | Get a free trial download of the latest version of IBM Rational Functional Tester V7.0.1. Rational Functional Tester is an automated functional and regression testing solution for QA teams concerned with the quality of their Java, Microsoft Visual Studio .NET, and Web-based applications. FREE! Go There Now!
| | | | You can now evaluate IBM Rational Asset Manager V7.0 online without installing or configuring it on your own system! Rational Asset Manager helps create, modify, govern, find, and reuse any type of development assets, including SOA and systems development assets. Rational Asset Manager helps you reduce software development costs and improve quality by facilitating the reuse of all types of software development-related assets. Visit developerWorks to learn more about this product and register to explore its capabilities online. FREE! Go There Now!
| | | | In this webcast, you'll get an introduction to the eXtreme Transaction Processing (XTP) features of WebSphere Extended Deployment and the common architectural traits required by XTP applications. See how WebSphere Extended Deployment's ObjectGrid feature provides a state-of-the-art infrastructure for hosting XTP applications. FREE! Go There Now!
| | | | All FREE IBM® developerWorks Tools! | |