[Wix] 安装时建Services, 用户, 虚拟目录....

博客介绍了Wix文档中如“ServiceInstall”等元素,虽能编译链接但安装时无作用,它们需配合自定义动作DLL工作。还说明了让这些元素正常工作的步骤,指出部分元素与自定义动作映射不清晰,且这些非原生元素使用效果不佳,安装用户时出错。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

If you have had a look at the documentation you’ve probably noticed a few elements like “ServiceInstall”, “User” and “WebVirtualDir”. What these elements all have in common is that if you add them to a wix document they will compile and link with out any problem, but they will not do anything at all on installation. If you take a closer at the msi produced using the reason they do nothing becomes clear, for example the User elements generates a table called user in the Msi and if you read the windows installer documentation you will quickly see there is no User table defined.

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

But why go to all the bother of putting these elements into the wix schema if they don’t do anything? They are there because they are designed to work with the wix custom action dlls, that is “scasched.dll” and “scaexec.dll”. The idea behind these is that common task such as creating users, installing services and virtual directories have been given there own set of wix commands even though they are not natively supported natively by the windows installer. I think this is a really good idea, but there is a down side, which I’ll cover towards then end of this post.

 

To make these elements work correctly you have to follow a number of steps that I have not seen documented anywhere. First of you need include the dll from the wix\ca in you’re install script, this is done with the following wix syntax (paths make of course vary depending on you’re install):

 

 

Next you need to try out the wix code to call into the correct custom action for the kind of elements you’re adding. Again I’ve not see this documented anywhere, but you can find what you need to know form the “scasched.cpp” file in the fix source. If you were trying to add a user then you would need the following CustomAction tag to call into the write bit of code.

 

 

You also need to specific when the custom action should be called; here is an easy to do this.

 

 

In all there are 6 custom action entry points listed in the source file “scasched.cpp”, these are:  ConfigureIIs

ConfigureSql

ConfigurePerfmonInstall

ConfigurePerfmonUninstall

ConfigureSmb

ConfigureUsers

 

 It is not entry clear which elements in wix these map, although they all probably map to sets of elements that will not work with out calling into code in the custom action dlls. It is important to note that these are sets of elements not individual elements. Some are fairly obvious; for example instal using any element prefixed with web needs to call into the ConfigureIIs custom action and ConfigureUsers action has three elements that will not work with out it, these are User, Group and GroupRef. However it’s odd that these is both ConfigurePerfmonInstall and ConfigurePerfmonUninstall where as the others just have one action. Also there appears to be a customaction missing as the element ServiceArgument, ServiceConfig, ServiceControl, ServiceDependency, ServiceInstall have no equivalent in the window install documentation, yet there is no customaction for them.  I’m going to try and work out exactly what maps to what and list in a later blog entry.

 

As I have menationed there is a down side to these none native elements. They don’t work very well. I’ve being trying to use them to install a user and it just isn’t working. I’ve put together this short sample that should install a local user, but it does not, it breaks with some very obscure errors. Create a log of the msi action clear show that the entires from the user table are being used, but don’t really reveal why it fails. Here is an excerpt log of the msi:

 

Action start <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />18:08:33: ConfigureUsers.

MSI (s) (F4:F0): Creating MSIHANDLE (33) of type 790542 for thread 2544

Action start 18:08:33: CreateUserRollback.

Action ended 18:08:33: CreateUserRollback. Return value 0.

ConfigureUsers:  Error 0x8007065a: Failed MsiDoAction on deferred action

ConfigureUsers:  Error 0x8007065a: failed to schedule RemoveUser

ConfigureUsers:  Error 0x8007065a: failed to add/remove User actions

Action ended 18:08:33: ConfigureUsers. Return value 3.

 

Can any one explain this error? Answers on a post card ...

posted on Monday, September 06, 2004 7:42 PM

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值