2017-01-26 4 views
0

Я сделал программу C# wpf, и на этом этапе у меня есть обновление, готовое к выпуску. Я создал установщик с помощью Wix Toolkit. Поэтому я могу создать файл msi. Но когда я делаю обновление с версии 1.0.0.0 до 2.0.0.0, программа вылетает после установки. Если я сначала удаляю программу C# с версией 1.0.0.0, а затем устанавливаю версию 2.0.0.0, все работает нормально. Я не знаю, что я делаю неправильно. это мой Product.wxs (мои идентификаторы GUID в моей программе реальные идентификаторы):Программа вылетает после обновления, но работает нормально с чистой установкой

<?xml version="1.0" encoding="UTF-8"?> 
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> 

    <?define ProductVersion="3.0.0.0"?> 
    <?define View_TargetDir=$(var.View.TargetDir)?> 
    <?define UpgradeCode="GUID-ID-FOR-UPGRADE"?> 
    <!-- 
    Version 1.0 
    <Product Id="GUID-ID-1" 
      Name="MIDIMACRO" 
      Language="1033" 
      Version="1.0.0.0" 
      Manufacturer="vanlooverenkoen" 
      UpgradeCode="$(var.UpgradeCode)"> 
    --> 

    <!-- 
    Version 2.0 
    --> 
    <Product Id="GUID-ID-2" 
      Name="MIDIMACRO" 
      Language="1033" 
      Version="$(var.ProductVersion)" 
      Manufacturer="vanlooverenkoen" 
      UpgradeCode="$(var.UpgradeCode)"> 



    <Package InstallerVersion="200" 
      Compressed="yes" 
      InstallScope="perMachine" /> 

    <Icon Id="icon.ico" 
      SourceFile="$(var.ProjectDir)Icon.ico" /> 
    <Property Id="ARPPRODUCTICON" 
       Value="icon.ico" /> 

    <WixVariable Id="WixUIBannerBmp" 
       Value="Images\installer_top-banner.bmp" /> 

    <WixVariable Id="WixUIDialogBmp" 
       Value="Images\installer_background.bmp" /> 

    <Property Id="WIXUI_INSTALLDIR" 
       Value="INSTALLFOLDER" /> 

    <UI> 
     <UIRef Id="WixUI_InstallDir" /> 
     <Publish Dialog="ExitDialog" 
       Control="Finish" 
       Event="DoAction" 
       Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed 
     </Publish> 
    </UI> 

    <MajorUpgrade Schedule="afterInstallInitialize" 
        DowngradeErrorMessage="A newer version of [ProductName] is already installed."/> 

    <MediaTemplate EmbedCab="yes" /> 

    <Feature Id="ProductFeature" Title="MIDIMACRO" Level="1"> 
     <ComponentGroupRef Id="ProductComponents" /> 
     <ComponentGroupRef Id="ProgramFilesFolder_files" /> 
     <ComponentRef Id="ApplicationShortcut" /> 
     <ComponentRef Id="ApplicationShortcutDesktop" /> 
    </Feature> 

    <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch MIDIMACRO" /> 

    <!-- Step 3: Include the custom action --> 
    <Property Id="WixShellExecTarget" Value="[INSTALLFOLDER]MIDIMACRO.exe" /> 
    <CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" /> 
    </Product> 

    <Fragment> 
    <Directory Id="TARGETDIR" Name="SourceDir"> 
     <Directory Id="ProgramFilesFolder"> 
     <Directory Id="INSTALLFOLDER" Name="MIDIMACRO" /> 
     </Directory> 
     <Directory Id="ProgramMenuFolder"> 
     <Directory Id="ApplicationProgramsFolder" Name="MIDIMACRO" /> 
     </Directory> 
     <Directory Id="DesktopFolder" Name="Desktop" /> 
    </Directory> 
    </Fragment> 

    <Fragment> 
    <DirectoryRef Id="ApplicationProgramsFolder"> 
     <Component Id="ApplicationShortcut" Guid="9bd13330-6540-406f-a3a8-d7f7c69ae7f9"> 
     <Shortcut Id="ApplicationStartMenuShortcut" Name="MIDIMACRO" Description="MIDIMACRO" Target="[INSTALLFOLDER]MIDIMACRO.exe" WorkingDirectory="INSTALLFOLDER" /> 
     <RemoveFolder Id="RemoveApplicationProgramsFolder" Directory="ApplicationProgramsFolder" On="uninstall" /> 
     <RegistryValue Root="HKCU" Key="Software\MIDIMACRO" Name="installed" Type="integer" Value="1" KeyPath="yes" /> 
     </Component> 
    </DirectoryRef> 
    <DirectoryRef Id="DesktopFolder"> 
     <Component Id="ApplicationShortcutDesktop" Guid="cde1e030-eb64-49a5-b7b8-400b379c2d1a"> 
     <Shortcut Id="ApplicationDesktopShortcut" Name="MIDIMACRO" Description="MIDIMACRO" Target="[INSTALLFOLDER]MIDIMACRO.exe" WorkingDirectory="INSTALLFOLDER" /> 
     <RemoveFolder Id="RemoveDesktopFolder" Directory="DesktopFolder" On="uninstall" /> 
     <RegistryValue Root="HKCU" Key="Software\MIDIMACRO" Name="installed" Type="integer" Value="1" KeyPath="yes" /> 
     </Component> 
    </DirectoryRef> 
    </Fragment> 

    <Fragment> 
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> 
     <!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. --> 
     <!-- <Component Id="ProductComponent"> --> 
     <!-- TODO: Insert files, registry keys, and other resources here. --> 
     <!-- </Component> --> 
     <Component Id="MahApps.Metro.dll" Guid="7903f312-19fb-45a5-8dc6-9823ada4cca0"> 
     <File Id="MahApps.Metro.dll" Name="MahApps.Metro.dll" Source="$(var.View_TargetDir)MahApps.Metro.dll" /> 
     </Component> 
     <Component Id="System.Windows.Interactivity.dll" Guid="4af9d18a-6205-4b23-887c-bf31685d548e"> 
     <File Id="System.Windows.Interactivity.dll" Name="System.Windows.Interactivity.dll" Source="$(var.View_TargetDir)System.Windows.Interactivity.dll" /> 
     </Component> 
     <Component Id="Newtonsoft.Json.dll" Guid="a97d5ecb-a716-43da-bd5f-83a7be929b47"> 
     <File Id="Newtonsoft.Json.dll" Name="Newtonsoft.Json.dll" Source="$(var.View_TargetDir)Newtonsoft.Json.dll" /> 
     </Component> 
     <Component Id="Sanford.Multimedia.Midi.dll" Guid="e098aa86-d81e-48e9-84ba-4bc548e3f074"> 
     <File Id="Sanford.Multimedia.Midi.dll" Name="Sanford.Multimedia.Midi.dll" Source="$(var.View_TargetDir)Sanford.Multimedia.Midi.dll" /> 
     </Component> 
     <Component Id="Controller.dll" Guid="2d5d325c-234a-4ae4-b3fb-c87d346fccf5"> 
     <File Id="Controller.dll" Name="Controller.dll" Source="$(var.View_TargetDir)Controller.dll" /> 
     </Component> 
     <Component Id="View.exe.config" Guid="e1f88ab9-55fb-4bcc-a88c-2834c63469e6"> 
     <File Id="View.exe.config" Name="MIDIMACRO.exe.config" Source="$(var.View_TargetDir)View.exe.config" /> 
     </Component> 
     <Component Id="View.exe" Guid="7388a307-32fa-4f56-8fc6-a558de5ab7e6"> 
     <File Id="View.exe" Name="MIDIMACRO.exe" Source="$(var.View_TargetDir)View.exe" /> 
     </Component> 
     <Component Id="Model.dll" Guid="2684cc98-d124-41d4-85e6-99ecc2c7e131"> 
     <File Id="Model.dll" Name="Model.dll" Source="$(var.View_TargetDir)Model.dll" /> 
     </Component> 
     <Component Id="MaterialDesignThemes.Wpf.dll" Guid="ccbfeca9-31fe-4d5c-a31a-5a264f69fd58"> 
     <File Id="MaterialDesignThemes.Wpf.dll" Name="MaterialDesignThemes.Wpf.dll" Source="$(var.View_TargetDir)MaterialDesignThemes.Wpf.dll" /> 
     </Component> 
     <Component Id="MaterialDesignThemes.MahApps.dll" Guid="66e05999-a097-4595-bffe-99e4afef2369"> 
     <File Id="MaterialDesignThemes.MahApps.dll" Name="MaterialDesignThemes.MahApps.dll" Source="$(var.View_TargetDir)MaterialDesignThemes.MahApps.dll" /> 
     </Component> 
     <Component Id="MaterialDesignColors.dll" Guid="28ef4cb6-386f-4c82-8999-39ff3e1cde9a"> 
     <File Id="MaterialDesignColors.dll" Name="MaterialDesignColors.dll" Source="$(var.View_TargetDir)MaterialDesignColors.dll" /> 
     </Component> 
     <Component Id="WindowsInput.dll" Guid="0a28ba53-41df-42b0-b997-cc7e86a47180"> 
     <File Id="WindowsInput.dll" Name="WindowsInput.dll" Source="$(var.View_TargetDir)WindowsInput.dll" /> 
     </Component> 
     <Component Id="Hardcodet.Wpf.TaskbarNotification.dll" Guid="1f4aaa97-ed7c-4d12-ac25-d5b0ba0fb734"> 
     <File Id="Hardcodet.Wpf.TaskbarNotification.dll" Name="Hardcodet.Wpf.TaskbarNotification.dll" Source="$(var.View_TargetDir)Hardcodet.Wpf.TaskbarNotification.dll" /> 
     </Component> 
     <Component Id="CSCore.dll" Guid="6dcfcc86-12d8-42f6-a297-87560a5a3182"> 
     <File Id="CSCore.dll" Name="CSCore.dll" Source="$(var.View_TargetDir)CSCore.dll" /> 
     </Component> 
     <Component Id="MaterialDesignThemes.Wpf.pdb" Guid="9bf8b60e-6944-4e65-b2e6-35d826ffff3d"> 
     <File Id="MaterialDesignThemes.Wpf.pdb" Name="MaterialDesignThemes.Wpf.pdb" Source="$(var.View_TargetDir)MaterialDesignThemes.Wpf.pdb" /> 
     </Component> 
     <Component Id="System.Reactive.PlatformServices.dll" Guid="1e4cf4a5-ec59-41de-b42a-1de602185483"> 
     <File Id="System.Reactive.PlatformServices.dll" Name="System.Reactive.PlatformServices.dll" Source="$(var.View_TargetDir)System.Reactive.PlatformServices.dll" /> 
     </Component> 
     <Component Id="System.Reactive.Linq.dll" Guid="3253a150-0b73-4dde-902e-93ecb4f3039b"> 
     <File Id="System.Reactive.Linq.dll" Name="System.Reactive.Linq.dll" Source="$(var.View_TargetDir)System.Reactive.Linq.dll" /> 
     </Component> 
     <Component Id="System.Reactive.Interfaces.dll" Guid="02c68719-7df6-4814-ab49-c5c2660448c4"> 
     <File Id="System.Reactive.Interfaces.dll" Name="System.Reactive.Interfaces.dll" Source="$(var.View_TargetDir)System.Reactive.Interfaces.dll" /> 
     </Component> 
     <Component Id="System.Reactive.Core.dll" Guid="11757dde-fbdc-489b-8de5-2e12bbdce7c0"> 
     <File Id="System.Reactive.Core.dll" Name="System.Reactive.Core.dll" Source="$(var.View_TargetDir)System.Reactive.Core.dll" /> 
     </Component> 
     <Component Id="MaterialDesignColors.pdb" Guid="b689cffb-a71f-45a1-83cd-97e9e265d491"> 
     <File Id="MaterialDesignColors.pdb" Name="MaterialDesignColors.pdb" Source="$(var.View_TargetDir)MaterialDesignColors.pdb" /> 
     </Component> 
     <Component Id="View.pdb" Guid="d8b9af45-0c0d-4cb3-b5e2-8b2cfe3e66cf"> 
     <File Id="View.pdb" Name="View.pdb" Source="$(var.View_TargetDir)View.pdb" /> 
     </Component> 
     <Component Id="MaterialDesignThemes.MahApps.pdb" Guid="0623abd7-239e-41b3-aa8c-e0c76272eb0d"> 
     <File Id="MaterialDesignThemes.MahApps.pdb" Name="MaterialDesignThemes.MahApps.pdb" Source="$(var.View_TargetDir)MaterialDesignThemes.MahApps.pdb" /> 
     </Component> 
     <Component Id="Firebase.Database.dll" Guid="598ae72f-65e9-4b12-a88f-480e47c9f02c"> 
     <File Id="Firebase.Database.dll" Name="Firebase.Database.dll" Source="$(var.View_TargetDir)Firebase.Database.dll" /> 
     </Component> 
     <Component Id="Controller.pdb" Guid="08fa8a12-2c45-4bf8-8d68-6d036117331d"> 
     <File Id="Controller.pdb" Name="Controller.pdb" Source="$(var.View_TargetDir)Controller.pdb" /> 
     </Component> 
     <Component Id="Model.pdb" Guid="1d408632-0906-4ef1-82d8-197b7665a03a"> 
     <File Id="Model.pdb" Name="Model.pdb" Source="$(var.View_TargetDir)Model.pdb" /> 
     </Component> 
    </ComponentGroup> 
    </Fragment> 

    <Fragment> 

    <ComponentGroup Id="ProgramFilesFolder_files" Directory="ProgramFilesFolder"> 

     <Component Id="resources_settings_icon.svg" Guid="7f417c29-b7f8-4282-b248-cb220436c6e0"> 

     <File Id="resources_settings_icon.svg" Name="settings_icon.svg" Source="$(var.View_TargetDir)resources\settings_icon.svg" /> 

     </Component> 

     <Component Id="resources_search_icon.svg" Guid="12291d78-6c79-4b35-9435-025a7bd4b063"> 

     <File Id="resources_search_icon.svg" Name="search_icon.svg" Source="$(var.View_TargetDir)resources\search_icon.svg" /> 

     </Component> 

     <Component Id="resources_flash_icon.svg" Guid="d84b95d6-bc6c-43d0-b7a3-15da8332cb2e"> 

     <File Id="resources_flash_icon.svg" Name="flash_icon.svg" Source="$(var.View_TargetDir)resources\flash_icon.svg" /> 

     </Component> 

     <Component Id="resources_gesture_icon.svg" Guid="3e5d81c5-7801-4fb3-9dda-4ba1fb593a87"> 

     <File Id="resources_gesture_icon.svg" Name="gesture_icon.svg" Source="$(var.View_TargetDir)resources\gesture_icon.svg" /> 

     </Component> 

     <Component Id="resources_add_circle_icon.svg" Guid="f56738c4-876a-4db3-8958-9d714450f1fa"> 

     <File Id="resources_add_circle_icon.svg" Name="add_circle_icon.svg" Source="$(var.View_TargetDir)resources\add_circle_icon.svg" /> 

     </Component> 

    </ComponentGroup> 

    </Fragment> 
</Wix> 
+0

Какое значение $ (var.ProductVersion)? –

+0

Все определения расположены в верхней части моей конфигурации –

+0

Мое предположение - это какой-то файл с неверсированным компонентом, который не устанавливается, а затем после обновления у вас либо есть старый файл установщика или файл вообще. Можете ли вы снова запустить обновление с включенным протоколированием? 'Msiexec/i UpgradeInstall.msi/l * v msilog.txt' Затем загляните в msilog, где планируется установить компоненты и функции для установки или нет. Вы также можете отредактировать свой вопрос, чтобы поместить разделы журнала или ссылку на журнал здесь. Вы хотите увидеть «Установленный: Отсутствует: Запрос: Локальный; Действие: Локальный» для всех новых файлов/обновленных файлов. –

ответ

3

Наиболее вероятным вопросом является сообщение в журнале:

Запрет установки компонента: {CCBFECA9-31FE- 4D5C-A31A-5A264F69FD58}, поскольку существует тот же компонент с более высоким версией ключевого файла

Это означает, что вы не обновили версию этого Dll. В результате Dll отсутствует, и ваше приложение выходит из строя. Там хорошее объяснение здесь:

https://blogs.msdn.microsoft.com/astebner/2015/11/16/why-windows-installer-removes-files-during-a-major-upgrade-if-they-go-backwards-in-version-numbers/

Основной проблемой является то, что в начале установки он решает, что он не будет перезаписывать этот файл, поскольку существующая версия о системе больше, чем «новый» входящего файла , поэтому он решает не устанавливать его вообще. Это правила перезаписи файлов. Однако позже происходит обновление, которое удаляет все старые файлы, но по-прежнему ошибочно придерживается идеи о том, что он не должен устанавливать этот файл, поэтому он отсутствует в конце установки.

+0

Но этот файл не обновляется –

+0

Или мне всегда нужно менять GUID для каждого компонента? –

+0

Я прочитал всю статью и связанный с ней пост stackoverflow, но я не понимаю, как это исправить. –

 Смежные вопросы

  • Нет связанных вопросов^_^