本文介绍了每次重新安装我的 msi 产品后,添加删除程序显示增加的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我的应用程序运行时,它会连接到一个在线存储库并检查是否有更高的版本可用.如果有更高版本可用,它会下载 MSI 并进行升级(即使用不同的产品版本进行小更新).升级完成后,运行正常.

问题是,每次升级我的产品时,ARP 都会显示它的大小增加.每次升级后大小都会累积.我检查了我的应用程序文件夹和其他目标文件夹中所有重新安装的文件,但没有重复文件或额外的日志文件.

我正在使用 MsiInstallProduct(msiFile, cmdLine) 执行重新安装.命令行"是:ALLUSERS=1 REINSTALLMODE=vamus REINSTALL=ALL CONFIGURATIONFILE=C:\ProgramData\myapp\ngsetup.ini

我在详细 msi 日志中观察到以下可疑内容:

  1. 在升级过程中,我的应用程序在后台启动一个进程 ngupdate.exe,它使用 2 个 dll(ngcommon.dll 和 ngevent.dll).这可能是 ARP 规模增加的原因吗?

日志片段:

:MSI (s) (1C:6C) [10:16:21:958]:执行操作:SetTargetFolder(Folder=C:\Windows\system32\)MSI (s) (1C:6C) [10:16:21:958]:执行操作:SetSourceFolder(Folder=1\SYSTEM~1\|System Folder\)MSI (s) (1C:6C) [10:16:21:958]: 执行操作:RegisterSharedComponentProvider(,,File=_B08FC512AED74917BAF4D6EAF379944E,Component={2DE76099-CD98-FD91-F4591,VersionA.B08F921.B08181304B08FC512AED74917BAF4D6EAF379944EProductCode={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]:执行操作:FileCopy(SourceName=NGCOMMON.DLL|ngcommon.dll,SourceCabKey=_B08FC512AED74917BAF4D6EAF379944E=DestName=ngcommon.DLL,Attributes=ngcommon.dll,182056,PerTick=65536,,VerifyMedia=1,,,,,CheckCRC=0,Version=11.2.0.118,Language=1033,InstallMode=130023424,,,,,,)MSI (s) (1C:6C) [10:16:21:965]:文件:C:\Windows\system32\ngcommon.dll;覆盖;不会打补丁;REINSTALLMODE 指定要覆盖的所有文件MSI (s) (1C:6C) [10:16:21:965]:文件_B08FC512AED74917BAF4D6EAF379944E"的来源被压缩MSI (s) (1C:6C) [10:16:21:965]:从现有文件重新应用安全性.MSI (s) (1C:6C) [10:16:21:966]:注意:1:2262 2:错误 3:-2147287038MSI (s) (1C:6C) [10:16:22:324]:产品:我的应用.文件 C:\Windows\system32\ngcommon.dll 正被以下进程使用:名称: ngupdate ,Id 3104.MSI (s) (1C:6C) [10:16:22:326]:验证文件的可访问性:ngcommon.dllMSI (s) (1C:6C) [10:16:22:332]:执行操作:FileCopy(SourceName=NGHELP.CHM|nghelp.chm,SourceCabKey=_C8D0297F24AD4BA5A9D4AAA0D3BAC0CC,DestName=nghelp.chm,Attributes90244,PerTick=65536,,VerifyMedia=1,,,,,CheckCRC=0,,,InstallMode=130023424,,,,,,,)MSI (s) (1C:6C) [10:16:22:333]:文件:C:\Windows\system32\nghelp.chm;覆盖;不会打补丁;REINSTALLMODE 指定要覆盖的所有文件MSI (s) (1C:6C) [10:16:22:333]:文件_C8D0297F24AD4BA5A9D4AAA0D3BAC0CC"的来源被压缩MSI (s) (1C:6C) [10:16:22:333]:从现有文件重新应用安全性.MSI (s) (1C:6C) [10:16:22:335]:验证文件的可访问性:nghelp.chmMSI (s) (1C:6C) [10:16:22:339]:执行操作:SetTargetFolder(Folder=C:\Windows\)MSI (s) (1C:6C) [10:16:22:339]:执行操作:SetSourceFolder(Folder=1\WINDOW~1\|Windows Folder\)MSI (s) (1C:6C) [10:16:22:339]: 执行操作:RegisterSharedComponentProvider(,,File=_DDBE1E1CB35A4E12AB1FA25F9D72738D,Component={30F988F9-ED4E-07C5-C3C3C307C5-C3C3C3.17C5-C3C73.07C5-C3C73ProductCode={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]:执行操作:FileCopy(SourceName=NGEVENT.DLL|ngevent.dll,SourceCabKey=_DDBE1E1CB35A4E12AB1FA25F9D72738D,DestName=ngevent.dll,AttributeSize=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]:文件:C:\Windows\ngevent.dll;覆盖;不会打补丁;REINSTALLMODE 指定要覆盖的所有文件MSI (s) (1C:6C) [10:16:22:346]:文件_DDBE1E1CB35A4E12AB1FA25F9D72738D"的来源被压缩MSI (s) (1C:6C) [10:16:22:347]:从现有文件重新应用安全性.MSI (s) (1C:6C) [10:16:22:347]:注意:1:2262 2:错误 3:-2147287038MSI (s) (1C:6C) [10:16:22:348]:产品:我的应用.以下进程正在使用文件 C:\Windows\ngevent.dll:名称: ngupdate ,Id 3104.MSI (s) (1C:6C) [10:16:22:350]:验证文件的可访问性:ngevent.dllMSI (s) (1C:6C) [10:16:22:354]:执行操作:SetTargetFolder(Folder=C:\Program Files\myapp\Install\)MSI (s) (1C:6C) [10:16:22:354]:执行操作:SetSourceFolder(Folder=1\INSTALL\|Install\):
  1. 从日志中,在 ProductRegister(...,) 中有一个参数EstimatedSize=1776".这与 ARP 中的大小增加问题有关吗?它有什么作用?

日志片段:

MSI (s) (1C:F8) [10:16:22:449]:使用 PID 1176 (0x498) 创建自定义操作服务器.MSI (s) (1C:B4) [10:16:22:475]:作为服务运行.MSI (s) (1C:B4) [10:16:22:477]:您好,我是您的 32 位 Elevated 自定义操作服务器.MSI (s) (1C:6C) [10:16:29:059]:执行操作:ActionStart(Name=RegisterProduct,Description=Registering product,Template=[1])MSI (s) (1C:6C) [10:16:29:059]:执行操作:ChangeMedia(,MediaPrompt=请插入磁盘:,MediaCabinet=_B80BF92501A9CB366CEFEB8C382A3536,BytesPerTick=0,Copierd\FileName=0Windows\Installer\1e88d181.msi,,,,,IsFirstPhysicalMedia=1)MSI (s) (1C:6C) [10:16:29:059]:执行操作:DatabaseCopy(DatabasePath=C:\Windows\Installer\1e88d181.msi,ProductCode={A2A78788-2792-49BF-AF22-5E9296E568F,,,)MSI (s) (1C:6C) [10:16:29:061]:验证文件的可访问性:1e88d180.msiMSI (s) (1C:6C) [10:16:29:074]:文件将从 OpCode 应用安全性.MSI (s) (1C:6C) [10:16:29:079]:执行操作: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]:执行操作:ProductCPDisplayInfoRegister()MSI (s) (1C:6C) [10:16:29:086]:执行操作:ActionStart(Name=PublishFeatures,Description=Publishing Product Features,Template=Feature: [1])MSI (s) (1C:6C) [10:16:29:086]:执行操作: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)ytF6lF@f[{1iy=Oh9nB5F`QG66mtjyXbeECC5(@Wm72Bd(t(CJFEv4bPNG&vGUTovbUqYauSv)[iXFCNfgZ&tjCvTx5SvCvTx5Hamp;3PuqTx5HampIrv@tx5SvCvTvCypSv@3(gc6=O]f.GGO)Ia7J+o=Q?P~^eP-%,oc)B~[fpsD}Clgdo0g.b07M.@&+utmClhlX.l_E.rMjs$+*P-'?Z...;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]:执行操作:ActionStart(Name=PublishProduct,Description=Publishing product information,)MSI (s) (1C:6C) [10:16:29:088]:执行操作:PackageCodePublish(PackageKey={5C921CC3-02D7-4BDF-BC56-6E2853B5E4FF})MSI (s) (1C:6C) [10:16:29:088]:执行操作:CleanupConfigData()MSI (s) (1C:6C) [10:16:29:088]:执行操作:RegisterPatchOrder(Continue=0,SequenceType=1,Remove=0)MSI (s) (1C:6C) [10:16:29:090]:执行操作:ProductPublishUpdate()MSI (s) (1C:6C) [10:16:29:091]:执行操作:SourceListRegisterLastUsed(SourceProduct={A2A78788-2792-49BF-AF22-5E9296E568F3},LastUsedSource=C:\ProgramData\myapp\)MSI (s) (1C:6C) [10:16:29:091]:进入 CMsiConfigurationManager::SetLastUsedSource.::

谢谢,库纳尔

解决方案

Visual Studio 设置项目充满了错误 - 它们一直都是.我强烈建议您立即切换到 Wix,并花时间学习它.你会为自己省去很多悲伤和麻烦.

Wix 工具包中有一个名为 dark.exe 的工具,可让您将现有的 MSI 反编译为 Wix 源 XML.通过一些清理,您可以使用反编译的 XML 源作为新 Wix 包的基础(需要一些剪切和粘贴技巧和 MSI 洞察力).Wix 功能齐全且可靠,而 Visual Studio 项目则不然,您将继续遇到各种限制.

对反编译 VSPROJ 的说明 - 尝试消除所有 GUI 元素并与标准 Wix GUI 类型链接以避免使事情复杂化.请参阅此问题:如何向WiX 工具集本教程.

在基本级别上,您可以通过插入此 Wix XML 来获得普通的安装程序 Wix GUI:

除非您需要自定义对话框,否则这会将 MSI 与默认 GUI 链接起来,这对您的安装程序来说已经足够好了.所以反编译的 VSPROJ MSI 的工作是找到 GUI 元素,删除整个段,并插入上面的一个 liner GUI 链接.完毕.您对 Windows Installer 了解得越多,显然就越容易执行此清理工作.

其他几篇包含进一步 Wix 建议和链接的文章(大多数是旧的):

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:

  1. 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\)
:
  1. 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')&LTx?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

解决方案

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.

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 产品后,添加删除程序显示增加的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 07:06