aho
Posts: 58
Joined: Thu Jul 21, 2016 4:38 pm

Microsoft Build Tools Installer fails when running within my Installer

Hi,
I'm trying to install "BuildTools for Visual Studio 2019" within my installer.
This is normaly done by running the "Visual Studio Installer" with specific arguments.

It works inside my test VM when I run the original Installer from Microsoft with these arguments from the Windows Console:
"vs_buildtools.exe --add Microsoft.VisualStudio.Workload.MSBuildTools --quiet --wait --norestart".

When I run it with the same arguments within my own Installer it does not work.
In the logs from the Microsoft Installer I see the following error:
BuildToolsInstallerLog.png
BuildToolsInstallerLog.png (66.08 KiB) Viewed 8644 times

It seems that my own installer is blocking the BuildTools-Installer. Similar to the problem with .NET Framework described here: https://www.advancedinstaller.com/user- ... uestion124

I tried running the BuildTools-Installer as "feature-based" "and post-install" prerequisite. Both with no success.

I had a similar problem with the SQL Server Installer. The solution was running the SQL Server Installer with the argument "/SkipInstallerRunCheck". The Build Tools Installer seems not to support this argument.

:?: I'm searching for a solution to run "BuildTools for Visual Studio 2019" within my installer, if I select a specific feature.
Is there anything I am missing to achieve this?
Is there a workaround?

Thanks for your help,
Andreas

Edit: BuildTools shall only be installed, if a specific feature is selected.
Catalin
Posts: 6585
Joined: Wed Jun 13, 2018 7:49 am

Re: Microsoft Build Tools Installer fails when running within my Installer

Hello Andreas,

There are indeed some installers which can not be installed as feature-based prerequisites (as you mentioned, an example of that would be the "SQL Server" - older versions - or ".NET Framework").

A solution to this would be to add your prerequisite as a pre-install one. However, this will not allow you to install it based on a feature selection.

In order for me to run few tests on my end, could you please let me know how you have downloaded only the executable for the Microsoft Build Tools? I have tried to search for it but I was not able to find it (the search only showed me results to download Visual Studio).

Looking forward to hearing from you.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
aho
Posts: 58
Joined: Thu Jul 21, 2016 4:38 pm

Re: Microsoft Build Tools Installer fails when running within my Installer

Hi Catalin,
thanks for your reply!
You can download the Installer from here: https://visualstudio.microsoft.com/downloads/

Download.png
Download.png (94.26 KiB) Viewed 8618 times

I run this installer with these arguments: "--add Microsoft.VisualStudio.Workload.MSBuildTools --quiet --wait --norestart"

I hope you can help me finding a better soltuion thatn as a pre-install prerequisite.

Best regards,
Andreas
Catalin
Posts: 6585
Joined: Wed Jun 13, 2018 7:49 am

Re: Microsoft Build Tools Installer fails when running within my Installer

Hello Andreas,

Thank you for your followup on this.

I have downloaded the setup and I managed to install it from Advanced Installer.

Basically, the setup is failing because there is another installation happening at the same time (as exposed in the log file).

To avoid this, we need to launch the setup asynchronously. To do so:

- please add the setup of your Microsoft Build tools in your project ("Files and Folders" page)

- in "Custom Actions" page, create a launch file custom action that will launch the setup with the required parameters. Here is a screenshot of how I have configured it:

vsbuildtools.png
vsbuildtools.png (140.49 KiB) Viewed 8610 times

As you can see, the setup is launched at the end of the installation (similar to a post-install prerequisite). One thing to be noted here is the "Wait for custom action to finish before proceeding" option which is unchecked (the custom action is run asynchronously).

Also, I have used the "/k" parameter who launches the cmd and then waits for an input in order to close. I have mostly used this for debugging purposes. In your case, you can use the "/c" parameter instead, which will launch the cmd and the close it (it will not wait for user input).

Also, make sure the path to the executable is encapsulated between quotes, as it may contain spaces. In order to get the property assigned to your executable, in the "Command line" field, simply input "[" and then from the dropdown, select "File..." and then select your executable.

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
aho
Posts: 58
Joined: Thu Jul 21, 2016 4:38 pm

Re: Microsoft Build Tools Installer fails when running within my Installer

Hi Catalin,
thanks for your help so far!

I tried it like you described (only difference is that I have checked "Run as Administrator" in LaunchFile Custom Action), but I still run into "another Installation is already runnging" troubles.

My installer is using an enhanced User Interface. Might this be a problem?
I'm using AI 16.9.
My Test VM is Running WIndows 7 64 bit.

Do you have further ideas what I could check or test?

Thanks,
Andreas
aho
Posts: 58
Joined: Thu Jul 21, 2016 4:38 pm

Re: Microsoft Build Tools Installer fails when running within my Installer

When using the workaround with "LaunchFile":
  • Do I need to close my installer window in order that the Build-Tools Installer can run successfully?
  • What happens if I do not click the "Finish" Button on the last page of my wizard fast enough? Will the Build Tools Installer be started and fail, since my installer is still running?
Thanks,
Andreas
Catalin
Posts: 6585
Joined: Wed Jun 13, 2018 7:49 am

Re: Microsoft Build Tools Installer fails when running within my Installer

Hello Andreas,

Did you uncheck the "Wait for custom action to finish before proceeding" and "Wait for return code at the end of the sequence" options as showcased in my previous screenshot?

This way, the installer should not be waiting for the custom action to finish, thefore the "another installation is already running" message should not be spawned.

Please make sure the options are unchecked and let me know if everything is working as expected.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
aho
Posts: 58
Joined: Thu Jul 21, 2016 4:38 pm

Re: Microsoft Build Tools Installer fails when running within my Installer

Yes, these are unchecked.
aho
Posts: 58
Joined: Thu Jul 21, 2016 4:38 pm

Re: Microsoft Build Tools Installer fails when running within my Installer

I have done a lot of tests until now.
I have found out, that when my Installer is started, two msiexec.exe processes are started.
If I quit my Installer (on the first page of the wizard, without clicking ever 'Next' button) one msiexec.exe process keeps hanging. I see this in the Windows Taskmanger.

This seems to be the reason, why the Build Tools Installer fails (Another Installation Running).

I have tested this on two different VMs (Windows 7 64 Bit and Windows 10 64 Bit). It's the same behaviour.

Why does this happen?
Are there settings I could check?

Best regards,
Andreas
aho
Posts: 58
Joined: Thu Jul 21, 2016 4:38 pm

Re: Microsoft Build Tools Installer fails when running within my Installer

I kept on testing.
I created a completely new Advanced Installer Project. It was created with the wizard and I have done no changes to the project. I just built the installer and ran it.

--> Here is the same behaviour: If i close my installer on the first page of the wizard, one MSIEXEC.exe process keeps remaining.

Since the AIP file and the installer are too big for attaching here, I will send it to support@advancedinstaller.com

:?: Is this a bug of Advanced Installer?
Or is there a setting which takes affect on this behaviour?

Best regards,
Andreas
Catalin
Posts: 6585
Joined: Wed Jun 13, 2018 7:49 am

Re: Microsoft Build Tools Installer fails when running within my Installer

Hello Andreas,

The fact that two msiexec.exe processes appear in the Task Manager is normal.

This happens because the whole mxiexec process consists of two processes - the client side (the UI that is displayed) and the server side (where the modifications of the systems are done - after your press the "Install" button).

I have tested some more scenarios and indeed:
Do I need to close my installer window in order that the Build-Tools Installer can run successfully?
What happens if I do not click the "Finish" Button on the last page of my wizard fast enough? Will the Build Tools Installer be started and fail, since my installer is still running?
this is the reason why the Build Tools installer does not successfully installs. In this case, the user needs to press the finish button in order for the product to be successfully installed.

When testing this, I have always pressed the Finish button (most likely, out of instinct). I have now ran few tests and I could indeed notice that the product is not installed if the first msiexec process is not terminated.

Here is how I've thought we can avoid this:

- first of all, we need to change the sequence of our custom action from "with sequence" to "without sequence". To do so, you can go to "Custom Actions" page --> select your custom action --> right click on it --> "Sequence" --> "Without Sequence".

This will allow us to trigger the custom action from a dialog button instead of it triggering automatically. I've been thinking that we can trigger the custom action when the user presses the "Finish" button so we can be sure that the main process does not interfere with the second installation.

- go to "Dialogs" page --> select "Exit" dialog --> select the "Finish" button --> under "Published Events" add a new event that will execute the custom action.

event.png
event.png (235.94 KiB) Viewed 8588 times

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
aho
Posts: 58
Joined: Thu Jul 21, 2016 4:38 pm

Re: Microsoft Build Tools Installer fails when running within my Installer

Hi Catalin,
thanks for your reply! I tried your solution with an new Advanced Installer Project. I ran into the same problem.
I think this is the problem:
aho wrote: Fri Apr 10, 2020 11:56 am I created a completely new Advanced Installer Project. It was created with the wizard and I have done no changes to the project. I just built the installer and ran it.

--> Here is the same behaviour: If i close my installer on the first page of the wizard, one MSIEXEC.exe process keeps remaining.

I would really appreciate it if you contact me and we look at it together with screens share.
I have created a new Project just running this custom action when clicking the Finish button. I habe also a virutal machine for testing.

Thanks so far,
Andreas
Catalin
Posts: 6585
Joined: Wed Jun 13, 2018 7:49 am

Re: Microsoft Build Tools Installer fails when running within my Installer

Hello Andreas,

I have answered you over the e-mail.

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

Return to “Building Installers”