在卸载升级的捆绑包时,Wix Managed Bootstrapper无法卸载WtsApi32.dll

时间:2015-02-27 07:12:24

标签: wix bootstrapper

我创建了一个托管引导程序(wix v3.9.1208.0),它的工作方式有点像Visual studio / Resharper安装程序,它的工作原理非常好:

  1. 安装时,它会安装先决条件,并安装或跳过您从捆绑的可用应用程序列表中选择的内容。
  2. 如果您修改则会卸载/跳过/安装您的选择。
  3. 卸载会删除所有非必备应用程序。
  4. 我的问题是我升级时的问题。正在升级的应用程序安装没有任何问题,甚至卸载以前的捆绑包也会在最后启动,但这是一切都出错的地方。 它进入ApplyComplete事件,我调用bootstrappers InvokeShutdown,然后停止。我的日志的最后几行到达这一点如下,最后的错误。

    [2950:1B18][2015-02-26T16:03:03]i207: Planned related bundle: {afe9a965-64d2-4656-a968-95ad1ca320a1}, type: Upgrade, default requested: None, ba requested: None, execute: None, rollback: None, dependency: None
    [2950:1B18][2015-02-26T16:03:03]i201: Planned package: App1, state: Absent, default requested: Absent, ba requested: Absent, execute: None, rollback: None, cache: No, uncache: No, dependency: Unregister
    [2950:1B18][2015-02-26T16:03:03]i201: Planned package: LicenceManager, state: Present, default requested: None, ba requested: None, execute: None, rollback: None, cache: No, uncache: No, dependency: Unregister
    [2950:1B18][2015-02-26T16:03:03]i201: Planned package: vcRedistx64, state: Present, default requested: None, ba requested: None, execute: None, rollback: None, cache: No, uncache: No, dependency: None
    [2950:1B18][2015-02-26T16:03:03]i201: Planned package: NetFx452Web, state: Present, default requested: None, ba requested: None, execute: None, rollback: None, cache: No, uncache: No, dependency: None
    [2950:1B18][2015-02-26T16:03:03]i201: Planned package: dotnetfx35setup.exe, state: Present, default requested: None, ba requested: None, execute: None, rollback: None, cache: No, uncache: No, dependency: None
    [2950:1B18][2015-02-26T16:03:03]i000: Executing OnPlanComplete
    [2950:1B18][2015-02-26T16:03:03]i299: Plan complete, result: 0x0
    [2950:1B18][2015-02-26T16:03:03]i300: Apply begin
    [2934:22D0][2015-02-26T16:03:03]i329: Removed package dependency provider: {93F9AE5C-EC11-4122-8F1D-11A4EEDAF4C9}, package: App1
    [2934:22D0][2015-02-26T16:03:03]i329: Removed package dependency provider: {2326EAF9-A4C2-4AE0-A22B-8B8640B1A151}, package: LicenceManager
    [2950:1B18][2015-02-26T16:03:03]i000: Executing OnExecuteComplete
    [2934:22D0][2015-02-26T16:03:03]i330: Removed bundle dependency provider: {41b57ce1-0fc2-4761-9779-fb0dab861ce9}
    [2934:22D0][2015-02-26T16:03:03]i352: Removing cached bundle: {41b57ce1-0fc2-4761-9779-fb0dab861ce9}, from path: C:\ProgramData\Package Cache\{41b57ce1-0fc2-4761-9779-fb0dab861ce9}\
    [2950:1B18][2015-02-26T16:03:03]i000: Executing OnApplyComplete
    [2950:1B18][2015-02-26T16:03:03]i000: OnApplyComplete() - Invoking shutdown due to Action being Uninstall
    [2950:20E8][2015-02-26T16:03:03]e000: Unable to load DLL 'WtsApi32.dll': Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
    

    我看了一下procmon,看看我是否可以获得更多的洞察力,并发现这些是最后几个条目。在锁定dll的日志条目之前,WtsApi32.dll有一个删除暂挂。关机是否试图过早发生?

    08:01:50.8330216    Bootstrapper.exe    12112   CreateFile  C:\ProgramData\Package Cache\{6ab12c5b-558c-42b4-9f60-958771befc1c}\POWRPROF.DLL    DELETE PENDING  Desired Access: Read Attributes,    Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
    08:01:50.8335070    Bootstrapper.exe    12112   CreateFile  C:\Windows\Microsoft.NET\assembly\GAC_MSIL\WindowsBase\v4.0_4.0.0.0__31bf3856ad364e35\WtsApi32.dll  NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
    08:01:50.8336118    Bootstrapper.exe    12112   CreateFile  C:\ProgramData\Package Cache\{6ab12c5b-558c-42b4-9f60-958771befc1c}\WtsApi32.dll    DELETE PENDING  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
    08:01:50.8341131    Bootstrapper.exe    12112   WriteFile   C:\Users\UserName\AppData\Local\Temp\BundleLog_20150227080127.log   SUCCESS Offset: 6,794, Length: 146
    

    如果我尝试在Windows资源管理器中运行,那么尝试删除wtsapi32.dll的包文件夹会显示为拒绝访问。

1 个答案:

答案 0 :(得分:0)

事实证明有人在我的自定义BA覆盖Run中注释了我的逻辑,以在某些场景中显示视图而不是其他场景。因此,当Command.Display嵌入时,代码试图显示我的视图,因此我认为dll在关闭时被锁定。 哦,至少找到了原因!