开发者

COM+ application deployment using command-line

I need to deploy my COM dll as a COM+ application. I used to do that from Component Services manager (dcomcnfg.exe). But my requirement is to deploy it from command-line. Is there a command to do that?

Update: An开发者_如何学Cd how to uninstall the same?

Thanks.


Here are a couple of scripts that dump a COM+ application's settings to an XML file, as well as installs applications from and XML file. It provided me a good framework for doing something similar a while back. It contains example code of how to create and remove COM+ applications using the COM+ administration API.


This vbscript snippet creates an application and installs a component:

Dim catalog
Dim applications
Dim application
Set catalog = CreateObject("COMAdmin.COMAdminCatalog")
Set applications = catalog.GetCollection("Applications")
Call applications.Populate
Set application = applications.Add()


' ID is an arbitrary GUID, that you can create using uuidgen
application.Value("ID") = "{da2d72e3-f402-4f98-a415-66d21dafc0a9}"
application.Value("Name") = "SampleApp"
application.Value("Activation") = 0' COMAdmin.COMAdminActivationOptions.COMAdminActivationLocal
application.Value("ApplicationAccessChecksEnabled") = 0 'COMAdmin.COMAdminAccessChecksLevelOptions.COMAdminAccessChecksApplicationComponentLevel
application.Value("Description") = "Sample Application"
'application.Value("Identity") = "machine\administrator"
'application.Value("Password") = "YourPassword"
application.Value("RunForever") = True

Call applications.SaveChanges

catalog.InstallComponent "SampleApp", "C:\Documents and Settings\me\My Documents\Test\MyTestProj.dll", "", ""


Set application = Nothing
Set applications = Nothing
Set catalog = Nothing

This is running on Windows XP -- other OS's may have different behavior. And it does seem to be pretty temperamental. If it doesn't work the errors are really vague and unhelpful.

To delete I think you will have to iterate over the the components in the application and remove from the list as per this example. I think a similar approach would be required to remove the entire application.

References

See Configurating COM+ for a good easy to understand article (but is not in script). MSDN has a good reference on Automating COM+ Administration and also the complete COM+ Administration Reference.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜