开发者

Using JScript or VBScript for CustomActions

In my installer I need to do the following: obtain location of the external application from registry and create folders for my application executive and various files in this “parent” directory. I know how to get this directory from registry, but unfortun开发者_Python百科ately the string I get looks like this: C:/Programm Files/Manufacturer/ExtApplication/extapp.exe.

For sure, it does not suit me. So, as I understand, I need to remove the “extapp.exe” part from it. I tried to do it via CustomAction using VBScript or JScript, but I am not experienced enough nether in both these scripts, nor wix itself. I read about Type51, Type 35, etc. CustomAction types, but I cannot get how I should 1) remove the part of the string; 2) use it in Directory element; 3) do all this before the installation of the files.

Will be grateful for any advice (without using Scripts as well).


First, you shouldn't use script custom actions. They are very fragile:

http://blogs.msdn.com/b/robmen/archive/2004/05/20/136530.aspx

Here is how I would roll:

1) Use RegLocator/AppSearch to pull the registry value into a property at the beginning of the isntall. Then call out to a C++ custom action that parses off the file name. This custom action should be scheduled before CostInitialize.

You won't use a 51 or a 35 here, you'll use a Type 1 with a call to MsiSetProperty() which is equivilant to Type 51. The difference between 51 and 35 is you use 51 before costing and 35 after costing.

The name of the property you set should match the name of the Id for the Directory table row you are using. Any children of that row will be relative path'd to what you set it to.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜