AndyL
Posts: 22
Joined: Tue Jan 26, 2021 12:58 pm

Why can't I move this resource to a new component?

Wed May 25, 2022 5:24 pm

I have a component, called "Web.config", which contains two resources: A web.config file, and a web.config XML transform.

I want to split them so the two resources are in separate components, because I now want to apply different conditions to each.

How can I do this? I can't figure it out. When I right-click either resource in the components tree, the "Move to New Component" option is disabled.
advinstcomponent.png
advinstcomponent.png (37.48KiB)Viewed 10963 times

Catalin
Posts: 6537
Joined: Wed Jun 13, 2018 7:49 am

Re: Why can't I move this resource to a new component?

Thu May 26, 2022 7:21 am

Hello Andy,

Most likely, that is happening because the XML transform is applied to that exact config file.

If the option is disabled, that means you can not move it to a new component (perhaps you could try to remove and re-add the files).

If possible, please forward me these two files (the web config file and the XML transform - or some similar sample files) and a small test-case so I can run some tests on my end, although I am not sure I will be able to find a solution to this.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

AndyL
Posts: 22
Joined: Tue Jan 26, 2021 12:58 pm

Re: Why can't I move this resource to a new component?

Thu May 26, 2022 10:13 am

I can drag-and-drop it to a different component, but that doesn't solve my problem because I don't have another component that I want to apply exactly the same conditions and attributes to. If I could manually create a new component, then I could move it there. I can't find a way to add a component though, unless I add some dummy file which seems like a less than ideal workaround.

Removing and re-adding the file is a last resort, because I'll have to recreate all the XML transform details via the "Edit XML file" dialog, and it would be too easy to make a mistake. If there's a way to export/import the details of the XML transform, then that might become a more viable option.

Catalin
Posts: 6537
Joined: Wed Jun 13, 2018 7:49 am

Re: Why can't I move this resource to a new component?

Thu May 26, 2022 12:05 pm

Hello,

I understand.

If adding a file is not ideal, then perhaps you can try to create a dummy registry entry and move it under that.

Besides that, I'm afraid I am not aware of any other workaround, since Windows Installer simply does not allow the creation of an empty component.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

AndyL
Posts: 22
Joined: Tue Jan 26, 2021 12:58 pm

Re: Why can't I move this resource to a new component?

Tue May 31, 2022 5:01 pm

I was able to solve this problem in the end by manually editing the .aip file to insert a new component entry, and link the resource to it instead of the old component.

Catalin
Posts: 6537
Joined: Wed Jun 13, 2018 7:49 am

Re: Why can't I move this resource to a new component?

Thu Jun 02, 2022 10:48 am

Hello Andy,

Thank you for your followup on this and for sharing your solution with us!

Glad you managed to work this around.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

MGS
Posts: 83
Joined: Tue Oct 04, 2022 9:52 am

Re: Why can't I move this resource to a new component?

Wed Aug 23, 2023 2:02 pm

I am running into the same problem. I added a new XML file to "Files and Folders". And now I can't move the XML File to a new component. So the XML file always has to be assigned to a component that already has a file inside. Can this be improved? You force the XML file to be assigned to a specific component anyways, why can't it be a new component?

Best regards,
Johannes

Catalin
Posts: 6537
Joined: Wed Jun 13, 2018 7:49 am

Re: Why can't I move this resource to a new component?

Thu Aug 24, 2023 3:33 pm

Hello Johannes,

I will discuss this with our dev team to see how we can improve this behavior.

In the meantime, I think I managed to find a workaround for this so you can create a new component for your XML file.

First of all, add your XML file in a separate folder. Then open the Advanced Installer project, go to "Files and Folders" page --> synchronize the folder with the folder on the disk.
Screenshot_43.png
Screenshot_43.png (81.66KiB)Viewed 9093 times

We need to make sure that the "Create a new component" option is checked so that a new component is created for each XML.

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

MGS
Posts: 83
Joined: Tue Oct 04, 2022 9:52 am

Re: Why can't I move this resource to a new component?

Wed Aug 30, 2023 11:38 am

Catalin wrote:
Thu Aug 24, 2023 3:33 pm
In the meantime, I think I managed to find a workaround for this so you can create a new component for your XML file.

First of all, add your XML file in a separate folder. Then open the Advanced Installer project, go to "Files and Folders" page --> synchronize the folder with the folder on the disk.
Hello Catalin,

Thanks, looking forward to an improvement :)

Thanks for coming up with another solution that's easy to follow. In the end, I decided against going this route though, as this way anyone could forget in the future that the folder is synchronized and adding files there or just delete the folder that is selected for synchronization. Instead I also edited the .aip file and assigned the XML file to a component manually. I am aware that this process can introduce errors too, so I hope you can come up with a solution in the future so that a XML file can be assigned to a new component.

Best regards,
Johannes

Catalin
Posts: 6537
Joined: Wed Jun 13, 2018 7:49 am

Re: Why can't I move this resource to a new component?

Thu Aug 31, 2023 1:25 pm

Thank you for your followup on this, Johannes!

Glad you managed to find a solution to this and thank you for sharing it with us.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”