[Tutorial]Modify an offline msi installer for administrative

Questions or comments on the switchless installers? Want to create a new one? Talk about it here.
Post Reply
User avatar
yumeyao
Moderator
Posts: 1718
Joined: Sun Aug 27, 2006 9:24 pm
Location: Taiyuan, Shanxi, PR China

[Tutorial]Modify an offline msi installer for administrative

Post by yumeyao » Sat Aug 29, 2009 11:52 pm

Last edited on 2009/9/18, 13:19 UTC

Let me explain the issue first:
.NET 3.5 SP1 and its language pack are offline msi installers indeed. They are different than regular installers therefore once you use "msiexec.exe /a" to deploy it, the output dir is much bigger than before and both msi and cab files are still there. Even updated files are useless as the msi file is totally same as before so it only regard the cab file as a valid source.

This fact is severe.
1. you can't get patches applied because updated files are ignored by the msi file.(you can try installing user_hidden's dotnet 3.5 and check file version of %SYSTEMROOT%\Microsoft.NET\Framework\v3.5\NetFX3.5InstallPath_GAC\System.Data.Services.Client.dll, it should have been 3.5.30729.196 if updated, but in reality it is 3.5.30729.1)

2. size is bumped. the original msi and cab is still there, and new files are in, so the final size increases.

3. If you just keep the original msi and cab, without attempting administrative install, you should have all patches applied later by starting msp files. this will still result a big 7zipped file.

So finding a way to make it administrative-deployable is very helpful for reducing package size.

Solution:
**** This part needs some basic msi knowledges ****

To work out a solution, we must first understand how is an offline msi installer different from a regular one.

When I'm paying effort on removing the msi itself and source cab from the msi's file table, I find that no matter how "clean" I think I have done, the modified msi still doesn't work. So I realized the copying of the msi and the cab must play a very important role during the installation, there a thought of "offline installer" rose.

Actually, I'm correct. As there is no document describing how to run the 2nd-step installation of an msi file, I decide to strip out the first step and then it works!

Open vs_setup.msi(comes from .NET 3.5 SP1) with orca, move to "Feature" table, you'll see a feature named "NetFX35_EXP_enu_x86_net_SETUP" with a level flag of 2, whereas most others are with a level flag of 1. So yes, this the "first step" which I want to strip out! To totally remove it, "Feature" "FeatureComponent" "Component" "Files" "Registry" and some more related tables(such as msifilehash, not necessary for a working msi) should be modified.

In next part I'll introduce with detailed steps for how to do it.

Steps:
Before we start, I recommend that you use InstEd to edit the msi file. It really has saved me a lot of time, so the steps below are all following InstEd.

1. make a copy of vs_setup.msi, for example here: vs_setup_org.msi. This copy is used for acquiring info for removed entries in progress.

2. open vs_setup.msi and vs_setup_org.msi in 2 windows of InstEd. Although InstEd allows you to open multiple msi files in one window, here we start 2 windows because once there is a dialog over it, you can't switch to a nother tab.

3. switch to vs_setup.msi, go to feature table, remove NetFX35_EXP_enu_x86_net_SETUP by selecting it and hitting delete key. InstEd pops a dialog prompting you for deleting related entries, click OK.

4. switch to vs_setup_org.msi, go to FeatureComponents table and look for all entries with Feature NetFX35_EXP_enu_x86_net_SETUP, each one points to a component.

5. switch to vs_setup.msi, go to component table, sorting entries by first column, then remove all components obtained in the previous point. Every time InstED pops a dialog, click OK directly.

6. go to FeatureExtensionData table, remove NetFX35_EXP_enu_x86_net_SETUP. (don't know if this step is necessary)

7. go to Property table, remove 2 entries: INSTALLLEVEL and ARPSYSTEMCOMPONENT.

8. save it, now you can deploy it!

Credits:
strel (one of Silent .NET Maker synthesized authors), who helped me realize how to make the installer uninstallable and shown in ARP. He also pointed that some steps are verbose and unnecessary, so I removed them.

Known Issues:
there is no issue currently. :D

Example (.NET 3.5 SP1):
my release here:
http://www.ryanvm.net/forum/viewtopic.php?t=7696
Last edited by yumeyao on Wed Sep 30, 2009 7:05 am, edited 3 times in total.
Image
My work list(Hosted by dumpydooby)

User avatar
beats
Posts: 772
Joined: Tue Nov 27, 2007 4:11 am
Location: Netherlands

Post by beats » Sun Aug 30, 2009 10:28 am

Thanks yumeyao, very useful post. :)

User avatar
yumeyao
Moderator
Posts: 1718
Joined: Sun Aug 27, 2006 9:24 pm
Location: Taiyuan, Shanxi, PR China

Post by yumeyao » Fri Sep 18, 2009 9:24 am

updated. fixed some issue no matter they WERE known or not because they ARE all gone!
Image
My work list(Hosted by dumpydooby)

User avatar
5eraph
Site Admin
Posts: 4618
Joined: Tue Jul 05, 2005 9:38 pm
Location: Riverview, MI USA

Post by 5eraph » Fri Sep 18, 2009 3:03 pm

Stickied. :)

ccl0
Posts: 817
Joined: Tue Jan 02, 2007 1:56 am

Post by ccl0 » Wed Sep 30, 2009 9:00 am

impressive

User avatar
ricktendo64
Posts: 3213
Joined: Mon May 22, 2006 12:27 am
Location: Honduras

Post by ricktendo64 » Thu Oct 01, 2009 5:54 pm

Hey thanks for this, I managed to shrink mine by more than 23 MB (langpacks included)

BTW InstallShield its much easier to use, all you do is delete the "NetFX35_EXP_enu_x86_net_SETUP" in "Setup Design" or "Features" then "Components" marked in Red

User avatar
ricktendo64
Posts: 3213
Joined: Mon May 22, 2006 12:27 am
Location: Honduras

Post by ricktendo64 » Thu Oct 22, 2009 1:13 pm

Hey yumeyao do you have the mst to remove the vc runtimes from this build?

I have the got the one from v2 from here but cant find the one for v3

Edit: nm I think I found it

User avatar
user_hidden
Posts: 1924
Joined: Thu Dec 06, 2007 7:52 am
Location: Canada eh!

admin install - slimmed down 4.0 Client Profile

Post by user_hidden » Tue Aug 17, 2010 8:16 pm

dotNet 4.0 Client Profile
===============

unpack the netfx40 package

2. open netfx_Core_x86.msi using Installsheild

3. go to Setup Design, remove Installer_Setup_ddf and Netfx_SetupUtility

4. go to Components table and look for all entries marked in RED icon before the component.

5. remove all components obtained in the previous point one by one click YES to delete.

6. remove Direct Editor -> CustomAction "CA_BlockDirectInstall"

7. remove Direct Editor -> InstallExecuteSequence "CA_BlockDirectInstall"

8. go to Property table, remove 2 entries: INSTALLLEVEL and ARPSYSTEMCOMPONENT. Change ALLUSERS=2 , add ARPNOMODIFY=0 ARPNOREPAIR=0

9. save the project and now you can deploy as an admin install and apply any MSP updates.

more removals can be done such as runtimes and such......

User avatar
yumeyao
Moderator
Posts: 1718
Joined: Sun Aug 27, 2006 9:24 pm
Location: Taiyuan, Shanxi, PR China

Post by yumeyao » Wed Aug 18, 2010 7:30 pm

That's almost same as what I have done, expect for:

I didn't change the property tables, but I changed a line in Registry Table:
reg2A4550084FFC9E27C15903C399B27CAF -> change it's value to "msiexec.exe /X [ProductCode]".

That's all a basic liting routine needs. But I'm also curious, do you have any MSP updates to test? I can't find any.

BTW I don't intend to remove runtimes, because this time the runtime "msvcr100_clr0400.dll" is located in system32, not as an assembly in WinSxS, so it serves only .NET 4.0 and never conflicts with others.

I have another question is that is feature "Netfx_NetFxRepair" needed? I can't even run it. I suppose this feature requires the installer copy, which we have removed, so it seems useless.
Image
My work list(Hosted by dumpydooby)

User avatar
ricktendo64
Posts: 3213
Joined: Mon May 22, 2006 12:27 am
Location: Honduras

Post by ricktendo64 » Wed Aug 18, 2010 8:22 pm

yumeyao wrote:But I'm also curious, do you have any MSP updates to test? I can't find any.
There have been quite a few updates for .net 4 SoLoR has a list (obsolete ones have been deleted)

User avatar
yumeyao
Moderator
Posts: 1718
Joined: Sun Aug 27, 2006 9:24 pm
Location: Taiyuan, Shanxi, PR China

Post by yumeyao » Wed Aug 18, 2010 10:45 pm

Thanks rick.
The tests failed. I should try keeping Netfx_NetFxRepair.
Image
My work list(Hosted by dumpydooby)

User avatar
ricktendo64
Posts: 3213
Joined: Mon May 22, 2006 12:27 am
Location: Honduras

Post by ricktendo64 » Wed Aug 18, 2010 11:16 pm

What you need to do is first integrate the fixes, then do the slimming down (some hotfixes update the setup files thats why integration may fail)

Keep a backup updated admin install with (no removals) all the setup files and fixes, when you get a new fix integrate it into those, then copy it, do removal, admin install again and deploy (new fix comes out, repeat)

This way you dont have to integrate all previous fixes and start from scratch everytime a new fix comes out

Edit: I have tried integrating the hotfixes and keeping the setup files, but when one installs it (via setup or msi), it does not look to the updated admin install folders for the files, it looks to the .cab/.mzz file

So if one wants to slipstream the .msp's, then removal is not only practical but a necessity

User avatar
yumeyao
Moderator
Posts: 1718
Joined: Sun Aug 27, 2006 9:24 pm
Location: Taiyuan, Shanxi, PR China

Post by yumeyao » Wed Aug 18, 2010 11:42 pm

The test I did was, installing an admin deployed .NET 4.0 without any updates, then installing msps on a live system. It failed installing msps.

I know the priciples that updates goes first, slimming down follows. I'm just concerning that no feature should be damaged(applying future updates is of course an important feature). That's why I'm asking for an update/hotfix for testing.

and yes, the removal is necessary, that's been approved in .NET 3.5, as the topic states.
Image
My work list(Hosted by dumpydooby)

User avatar
ricktendo64
Posts: 3213
Joined: Mon May 22, 2006 12:27 am
Location: Honduras

Post by ricktendo64 » Wed Aug 18, 2010 11:46 pm

Its a real bitch this .net 4

User avatar
yumeyao
Moderator
Posts: 1718
Joined: Sun Aug 27, 2006 9:24 pm
Location: Taiyuan, Shanxi, PR China

Post by yumeyao » Thu Aug 19, 2010 1:19 am

The entries in Feature Table should be kept. Removing all the related components just as mentioned above and keeping the features result a good slimming down.
Image
My work list(Hosted by dumpydooby)

Post Reply