问题
When my application is run, it connects to an online repository and checks if a higher version is available. If higher version is available it downloads the MSI and does an upgrade (i.e do a minor update by using different product version). After upgrade is complete, it runs normally.
THe problem is, ARP shows an increased size for my product each time I upgrade it. THe size accumulates after each upgrade. I checked all the reinstalled files in my application folder and other destination folders, but there were no duplicate files or extra log files.
I am using MsiInstallProduct(msiFile, cmdLine) to perform reinstall. 'cmdline' is : ALLUSERS=1 REINSTALLMODE=vamus REINSTALL=ALL CONFIGURATIONFILE=C:\ProgramData\myapp\ngsetup.ini
I observed following suspicious things in Verbose msi log:
- During upgrade, my application starts a process ngupdate.exe in the background which uses 2 dlls (ngcommon.dll and ngevent.dll). Can this be a reason for the size increase in ARP?
Log snippet:
:
MSI (s) (1C:6C) [10:16:21:958]: Executing op: SetTargetFolder(Folder=C:\Windows\system32\)
MSI (s) (1C:6C) [10:16:21:958]: Executing op: SetSourceFolder(Folder=1\SYSTEM~1\|System Folder\)
MSI (s) (1C:6C) [10:16:21:958]: Executing op: RegisterSharedComponentProvider(,,File=_B08FC512AED74917BAF4D6EAF379944E,Component={2DE76099-CD98-FD91-F426-2B97BB134A59},ComponentVersion=11.2.0.118,ProductCode={A2A78788-2792-49BF-AF22-5E9296E568F3},ProductVersion=11.20.118,PatchSize=0,PatchAttributes=0,PatchSequence=0,SharedComponent=0,IsFullFile=0)
MSI (s) (1C:6C) [10:16:21:964]: Executing op: FileCopy(SourceName=NGCOMMON.DLL|ngcommon.dll,SourceCabKey=_B08FC512AED74917BAF4D6EAF379944E,DestName=ngcommon.dll,Attributes=512,FileSize=182056,PerTick=65536,,VerifyMedia=1,,,,,CheckCRC=0,Version=11.2.0.118,Language=1033,InstallMode=130023424,,,,,,,)
MSI (s) (1C:6C) [10:16:21:965]: File: C:\Windows\system32\ngcommon.dll; Overwrite; Won't patch; REINSTALLMODE specifies all files to be overwritten
MSI (s) (1C:6C) [10:16:21:965]: Source for file '_B08FC512AED74917BAF4D6EAF379944E' is compressed
MSI (s) (1C:6C) [10:16:21:965]: Re-applying security from existing file.
MSI (s) (1C:6C) [10:16:21:966]: Note: 1: 2262 2: Error 3: -2147287038
MSI (s) (1C:6C) [10:16:22:324]: Product: My App. The file C:\Windows\system32\ngcommon.dll is being used by the following process: Name: ngupdate , Id 3104.
MSI (s) (1C:6C) [10:16:22:326]: Verifying accessibility of file: ngcommon.dll
MSI (s) (1C:6C) [10:16:22:332]: Executing op: FileCopy(SourceName=NGHELP.CHM|nghelp.chm,SourceCabKey=_C8D0297F24AD4BA5A9D4AAA0D3BAC0CC,DestName=nghelp.chm,Attributes=512,FileSize=90244,PerTick=65536,,VerifyMedia=1,,,,,CheckCRC=0,,,InstallMode=130023424,,,,,,,)
MSI (s) (1C:6C) [10:16:22:333]: File: C:\Windows\system32\nghelp.chm; Overwrite; Won't patch; REINSTALLMODE specifies all files to be overwritten
MSI (s) (1C:6C) [10:16:22:333]: Source for file '_C8D0297F24AD4BA5A9D4AAA0D3BAC0CC' is compressed
MSI (s) (1C:6C) [10:16:22:333]: Re-applying security from existing file.
MSI (s) (1C:6C) [10:16:22:335]: Verifying accessibility of file: nghelp.chm
MSI (s) (1C:6C) [10:16:22:339]: Executing op: SetTargetFolder(Folder=C:\Windows\)
MSI (s) (1C:6C) [10:16:22:339]: Executing op: SetSourceFolder(Folder=1\WINDOW~1\|Windows Folder\)
MSI (s) (1C:6C) [10:16:22:339]: Executing op: RegisterSharedComponentProvider(,,File=_DDBE1E1CB35A4E12AB1FA25F9D72738D,Component={30F988F9-ED4E-07C5-C3C3-30FECE7447FF},ComponentVersion=11.2.0.118,ProductCode={A2A78788-2792-49BF-AF22-5E9296E568F3},ProductVersion=11.20.118,PatchSize=0,PatchAttributes=0,PatchSequence=0,SharedComponent=0,IsFullFile=0)
MSI (s) (1C:6C) [10:16:22:345]: Executing op: FileCopy(SourceName=NGEVENT.DLL|ngevent.dll,SourceCabKey=_DDBE1E1CB35A4E12AB1FA25F9D72738D,DestName=ngevent.dll,Attributes=512,FileSize=64296,PerTick=65536,,VerifyMedia=1,,,,,CheckCRC=0,Version=11.2.0.118,Language=1033,InstallMode=130023424,,,,,,,)
MSI (s) (1C:6C) [10:16:22:346]: File: C:\Windows\ngevent.dll; Overwrite; Won't patch; REINSTALLMODE specifies all files to be overwritten
MSI (s) (1C:6C) [10:16:22:346]: Source for file '_DDBE1E1CB35A4E12AB1FA25F9D72738D' is compressed
MSI (s) (1C:6C) [10:16:22:347]: Re-applying security from existing file.
MSI (s) (1C:6C) [10:16:22:347]: Note: 1: 2262 2: Error 3: -2147287038
MSI (s) (1C:6C) [10:16:22:348]: Product: My App. The file C:\Windows\ngevent.dll is being used by the following process: Name: ngupdate , Id 3104.
MSI (s) (1C:6C) [10:16:22:350]: Verifying accessibility of file: ngevent.dll
MSI (s) (1C:6C) [10:16:22:354]: Executing op: SetTargetFolder(Folder=C:\Program Files\myapp\Install\)
MSI (s) (1C:6C) [10:16:22:354]: Executing op: SetSourceFolder(Folder=1\INSTALL\|Install\)
:
- From the logs, in ProductRegister(...,) there is a parameter "EstimatedSize=1776". Is this related to the size increase issue in ARP? What does it do?
Log Snippet:
MSI (s) (1C:F8) [10:16:22:449]: Created Custom Action Server with PID 1176 (0x498).
MSI (s) (1C:B4) [10:16:22:475]: Running as a service.
MSI (s) (1C:B4) [10:16:22:477]: Hello, I'm your 32bit Elevated custom action server.
MSI (s) (1C:6C) [10:16:29:059]: Executing op: ActionStart(Name=RegisterProduct,Description=Registering product,Template=[1])
MSI (s) (1C:6C) [10:16:29:059]: Executing op: ChangeMedia(,MediaPrompt=Please insert the disk: ,MediaCabinet=_B80BF92501A9CB366CEFEB8C382A3536,BytesPerTick=0,CopierType=2,ModuleFileName=C:\Windows\Installer\1e88d181.msi,,,,,IsFirstPhysicalMedia=1)
MSI (s) (1C:6C) [10:16:29:059]: Executing op: DatabaseCopy(DatabasePath=C:\Windows\Installer\1e88d181.msi,ProductCode={A2A78788-2792-49BF-AF22-5E9296E568F3},,,)
MSI (s) (1C:6C) [10:16:29:061]: Verifying accessibility of file: 1e88d180.msi
MSI (s) (1C:6C) [10:16:29:074]: File will have security applied from OpCode.
MSI (s) (1C:6C) [10:16:29:079]: Executing op: ProductRegister(UpgradeCode={81E3FF66-F6BB-49D7-A544-2FF3353BC128},VersionString=11.20.118,HelpLink=https://help.myapp.com/help.asp,,,InstallSource=C:\ProgramData\myapp\,Publisher=App Inc.,URLInfoAbout=http://www.myapp.com/us/en/support/contact.html#e-class,,,,,,,Contact=App Inc.,,,,EstimatedSize=1776,,,,)
MSI (s) (1C:6C) [10:16:29:084]: Executing op: ProductCPDisplayInfoRegister()
MSI (s) (1C:6C) [10:16:29:086]: Executing op: ActionStart(Name=PublishFeatures,Description=Publishing Product Features,Template=Feature: [1])
MSI (s) (1C:6C) [10:16:29:086]: Executing op: FeaturePublish(Feature=DefaultFeature,,Absent=2,Component=c-?rk6J{f`&VZ0V-m239QWWxn`42T!4sSaIbbqY$%@s+O!{e,ph8~k4Wa^db=K8^)f(XvC.[Z?4[1voA[7dAyT[uBZFb[ZmBwlaC=j@i2PXJj[=ptVPS'k94kxu_4f(ROJYf+,KX=m(T.q&t7Wyg9RpF3Ov)ytF6lF@f[{1iy=Oh9nB5F`QG66mtjyXbeECC5(@Wm72Bd(t(CJFEv4bPNG&vGUTovbUqYauSv[iXFCNfgIRV@uZPZ4=3!3+7Nq5)taHoE3t`T2w')<x?SSIjTvjERXC[Av(gc6=O]f.GGO)Ia7J+o=Q?P~^eP-%,oc)B~[fpsD}Clgdo0g.b07M.@&+utmClhlX.l_E.rMjs$+*P-'?Z.VBu)yyNNnZb@SZ^'yZRu87v3bQ6?h3U&i2tF8Rz[LiYXEG@dDt!eA[iHgB&S*%P99eBR(%Wxg3,*FR%0=5dz^4y&{izS_KJ=(dZo%i0Pboj'$[3&laN']V-wYa.k*@c$jM}`.J[bJ-z@B,Sl^[fIL?H@G*03wMC]@qrXyqA^N)
MSI (s) (1C:6C) [10:16:29:088]: Executing op: ActionStart(Name=PublishProduct,Description=Publishing product information,)
MSI (s) (1C:6C) [10:16:29:088]: Executing op: PackageCodePublish(PackageKey={5C921CC3-02D7-4BDF-BC56-6E2853B5E4FF})
MSI (s) (1C:6C) [10:16:29:088]: Executing op: CleanupConfigData()
MSI (s) (1C:6C) [10:16:29:088]: Executing op: RegisterPatchOrder(Continue=0,SequenceType=1,Remove=0)
MSI (s) (1C:6C) [10:16:29:090]: Executing op: ProductPublishUpdate()
MSI (s) (1C:6C) [10:16:29:091]: Executing op: SourceListRegisterLastUsed(SourceProduct={A2A78788-2792-49BF-AF22-5E9296E568F3},LastUsedSource=C:\ProgramData\myapp\)
MSI (s) (1C:6C) [10:16:29:091]: Entering CMsiConfigurationManager::SetLastUsedSource.
:
:
THanks, Kunal
回答1:
Visual studio setup projects are full of bugs - they always have been. I seriously suggest you switch to Wix immediately, and spend the time learning it. You will save yourself a lot of grief and problems.
- Wix tutorial (a well known tutorial for Wix newbies)
- My suggested Wix "quick start approach" (for the hands-on technies)
- Code Project: Quick Introduction to Wix (recommend this first to understand scope)
- An Unofficial History of Wix (to understand where Wix is coming from and what it delivers)
- Some Facts About Different Installation Products (other products used to create installers)
There is a tool in the Wix toolkit called dark.exe that allows you to decompile your existing MSI into Wix source XML. With some cleanup you can use the decompiled XML source as the basis of your new Wix package (somy cut and paste skill and MSI insight necessary). Wix is full-featured and reliable, Visual Studio projects are not and you would continue to hit all kinds of limitations.
A note to decompiled VSPROJ - try to eliminate all GUI elements and link with a standard Wix GUI type to avoid complicating things. See this question: How can I add an optional UI to WiX toolset and this tutorial.
At a basic level you can get a normal installer Wix GUI by inserting this Wix XML:
<UIRef Id="WixUI_Minimal" />
This links the MSI with a default GUI which is good enough for your installer unless you need a custom dialog. So the effort with the decompiled VSPROJ MSI is to find the GUI elements, delete the whole segment, and inserting the above one liner GUI link. Done. The more you know Windows Installer the easier it is to do this cleanup obviously.
A couple of other articles with further Wix suggestions and links (most are older):
- MSI Reference Counting: Two products install the same MSIs
- MSI vs nuget packages: which are is better for continuous delivery?
- Wix to Install multiple Applications (more on the management of several related installers)
- How to implement WiX installer upgrade?
- Good resources for learning how to create MSI installers from WiX
- Installer capabilities, WIX vs InstallShield Express
- How to include wxi file into wxs?
- WiX tricks and tips
来源:https://stackoverflow.com/questions/26917214/add-remove-programs-show-increased-size-after-each-reinstall-of-my-msi-product