osherk
Posts: 41
Joined: Mon Apr 20, 2015 11:55 am

Copying xml file due to a chosen component

Hi,

I have an issue which I can't solve.
I need to copy an xml file from a location in the pc to folder: c:\windows\syswow64.

I divided my exe into 3 components and I need the xml to be copied only when one of the components is chosen in the 'ConfigureDlg'.
The xml is not a part of my components. it's a simple file on my pc.

let's say I have 3 components under MainFeature in organization tab:
1.ServiceA
2.ServiceB
3.WebApp

I want the xml to be copied only when I choose ServiceA in 'ConfigureDlg'. let's say the xml name is 'test.xml'.

I did the following:
1. I copied test.xml under the folder of ServiceA in my pc.
2. I created a new custom action with the following settings:

file path: c:\windows\syswow64\cmd.exe
command line: /C COPY /Y "[ServiceA_dir]test.xml" "c:\windows\syswow64" (remark: [ServiceA_dir] is the location where all files of ServiceA exist (including test.xml))
condition: ((&ServiceA= 3) AND NOT (!ServiceA= 3)) AND VersionNT64

When I run the exe I get an error that the copy can't be done. when I see the log, I see the source location is where I actually install the application, for example:
c:\ProgramFiles\Company\ServiceA

ServiceA is not installed at this point so of course the path c:\ProgramFiles\Company\ServiceA does not exist. why does it search there?
The file path is [ServiceA_dir]test.xml and [ServiceA_dir] is the location where all files of ServiceA exist (including test.xml). why does it search in Program files?

Maybe there is another way to copy a file depending on a chosen component in 'ConfigureDlg'?
I try to solve it for 3 days....

Many thanks!!!
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Copying xml file due to a chosen component

Hi,

Please make sure that you use as a source folder for your XML file a property that is resolved to the correct folder (i.e. you can create a property-based folder to achieve this).
(remark: [ServiceA_dir] is the location where all files of ServiceA exist (including test.xml))
Is the [ServiceA_dir] folder a property-based folder in your project or you just did a synchronization between it and the "ServiceA" folder from your machine? If you only did a synchronization it does not mean that during the installation the [ServiceA_dir] property will point to that folder.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
osherk
Posts: 41
Joined: Mon Apr 20, 2015 11:55 am

Re: Copying xml file due to a chosen component

Hi,

[ServiceA_dir] is a property-based folder in my project.
I have added all relevant screenshot. (at my case the xml is 'Nav360config.xml' and the property is [AAEPBilling_dir].
Please take a look...

Thanks!
Attachments
files and folder.png
files and folder.png (140.04 KiB) Viewed 7451 times
The value of AAEPBilling_Dir.png
The value of AAEPBilling_Dir.png (49.15 KiB) Viewed 7451 times
custom actions.png
custom actions.png (45.63 KiB) Viewed 7451 times
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Copying xml file due to a chosen component

Hi,

I'm not sure why you encounter this problem. I testes the scenario and it worked well to me. Can you please send us the .AIP (project file) and a verbose log of the installation to support at advancedinstaller dot com, so we can investigate them?

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
osherk
Posts: 41
Joined: Mon Apr 20, 2015 11:55 am

Re: Copying xml file due to a chosen component

thanks, I sent the files to your email address.
maybe the problem is that the xml file should be copied for both system32 and syswow64? you can see in the custom actions....
how can I solve it at this case?

And another question - if I want this xml to be copied not only if I choose service AAEPBilling but also if I choose service ACCCMBillingEngine (both are in the 'files and folders''), what should I do?

For summary the conditions to copy the xml file are:

1. if I choose in ConfigureDlg service - AAEPBilling, it should be copied (if the operation system is 64 bit - to both system32 and syswow64. if the operation system is 32 bit - to only system32).
2. if I choose in ConfigureDlg service - ACCCMBillingEngine , it should be copied the same as #1.
3. If I don't choose any of the services above - the xml won't be copied to neither 32 nor 64.
4. If I choose both of the services above - the xml will be copied as I described at #1 and #2. Of course it can be copied once to 32 and once to 64.

Since I investigate this issue for several days with no solution - please help me in that.

Many thanks!
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Copying xml file due to a chosen component

Hi,

I looked over the files that you sent and I found that the "copyconfig32bit" custom action is the one that fails. This happens because that custom action is set to run as "Immediately", but at that point the XML file is not yet available on the machine.

Also, if you want to execute that custom action only on 32-bit machines, you need to set the appropriate condition for it (i.e. add "AND NOT VersionNT64" condition to the existing one).

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
osherk
Posts: 41
Joined: Mon Apr 20, 2015 11:55 am

Re: Copying xml file due to a chosen component

thanks, I will check it.
Can you answer me about the other service (as I mentioned in my last request in the form)?

I copy the question here:
And another question - if I want this xml to be copied not only if I choose service AAEPBilling but also if I choose service ACCCMBillingEngine (both are in the 'files and folders''), what should I do?

For summary the conditions to copy the xml file are:

1. if I choose in ConfigureDlg service - AAEPBilling, it should be copied (if the operation system is 64 bit - to both system32 and syswow64. if the operation system is 32 bit - to only system32).
2. if I choose in ConfigureDlg service - ACCCMBillingEngine , it should be copied the same as #1.
3. If I don't choose any of the services above - the xml won't be copied to neither 32 nor 64.
4. If I choose both of the services above - the xml will be copied as I described at #1 and #2. Of course it can be copied once to 32 and once to 64.

Since I investigate this issue for several days with no solution - please help me in that.

Many thanks!
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Copying xml file due to a chosen component

Hi,
And another question - if I want this xml to be copied not only if I choose service AAEPBilling but also if I choose service ACCCMBillingEngine (both are in the 'files and folders''), what should I do?
In order to achieve this you need to follow the steps below:
- create a "dummy" resource (i.e. registry value or file)
- go in the "Organization" page and add that "dummy" resource to its own component
- add that component under the "AAEPBilling" feature
- while the "SHIFT" keyboard button is pressed drag and drop that component under the "ACCCMBillingEngine" feature (this way the component will be shared between the two features)
- edit the "NAV360Config.xml" file and in the "Install" tab choose the component above as its related component

In the case described above, the XML file will be installed on the machine when any of the "AAEPBilling" or "ACCCMBillingEngine" features will be chosen for installation.
1. if I choose in ConfigureDlg service - AAEPBilling, it should be copied (if the operation system is 64 bit - to both system32 and syswow64. if the operation system is 32 bit - to only system32).
2. if I choose in ConfigureDlg service - ACCCMBillingEngine , it should be copied the same as #1.
3. If I don't choose any of the services above - the xml won't be copied to neither 32 nor 64.
4. If I choose both of the services above - the xml will be copied as I described at #1 and #2. Of course it can be copied once to 32 and once to 64.
In order to achieve this you need to keep your 32-bit and 64-bit custom action and set the appropriate conditions for them. For instance:
  • For the 64-bit custom action: (((&AAEPBilling= 3) AND NOT (!AAEPBilling= 3)) OR ((&ACCCMBillingEngine= 3) AND NOT (!ACCCMBillingEngine= 3))) AND VersionNT64
    For the 32-bit custom action: (((&AAEPBilling= 3) AND NOT (!AAEPBilling= 3)) OR ((&ACCCMBillingEngine= 3) AND NOT (!ACCCMBillingEngine= 3)))
However, I'm afraid that a 32-bit package cannot access 64-bit locations (i.e. the "System32" folder), so in order to achieve this, you need a 64-bit package. Also, in order to be able to install your package on a 32-bit machine you need a 32-bit package, so in this case you can create a "Mixed 32/64-bit" package.

If you do not want to create a mixed package type, you can replace the custom action that copies the XML file to the "System32" folder with a "Launch file" custom action which will launch a BAT file that contains your code, then check the "Use 64-bit Launcher" option for that custom action. Also, you can create an "Execute inline script" custom action and check the "64-bit script" option for it.

Let me know if this helped, otherwise give me more details about your scenario.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
osherk
Posts: 41
Joined: Mon Apr 20, 2015 11:55 am

Re: Copying xml file due to a chosen component

Thanks a lot for your detailed explanations.
I tried them and did the steps you described.
The problem with the ‘immediately’ settings was solved and the file is copied to both 32 and 64 bit.

But there is a strange problem:
There are 3 options that if one of them is checked, the xml file should be copied to both 32 and 64 depends on the operating system – the 2 services which I mentioned before and the web application.
The result is very strange – when I check only one of the services – the xml is copied and in addition it’s folder is copied too (unnecessary).
When I check only the web, the xml is not copied at all neither to 32 nor 64 and the folder is not created under program files.
The installation is done completely with no errors.
I attached the aip file to the mail: support at advancedinstaller dot com
Please check what is wrong.
Thanks!

Return to “Common Problems”