wix c# 应用程序在安装后无法启动 [英] wix c# app doesn't launch after installing

查看:28
本文介绍了wix c# 应用程序在安装后无法启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 Wix 成功生成并成功安装了我的 C# WPF 应用程序.该应用程序包括 Crystal 报表 dll 和其他一些 dll,如 Zen Barecode.在第 n 次尝试修改主项目后,MSI 能够自行安装,但通过从快捷方式或直接从可执行文件启动应用程序,它无法启动.

I have already successfully generated and successfully installed my C # WPF application with Wix. The application includes Crystal report dll and some other dll like Zen Barecode. After an nth attempt to modify the main project, the MSI is able to install itself but by launching the application either from the shortcuts or the executable directly, it does not start.

这是我的 wix product.wxs

Here is my wix product.wxs

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="*"
           Name="MyApp 1.0.0"
           Language="1036"
           Codepage="1252"
           Version="1.0.0"
           Manufacturer="My Company"
           UpgradeCode="PUT-GUID-HERE">
    <Package InstallerVersion="200"
             Compressed="yes"
             InstallScope="perMachine"
             Description="Some description"
             Keywords="Some keywords"
             Comments="(c) some comments"
             />

    <MajorUpgrade DowngradeErrorMessage="La dernière version de MyApp est déjà installée" />
    <MediaTemplate EmbedCab="yes" />

    <Icon Id="icon.ico" SourceFile="$(var.InstallFolderPath)logo.ico"/>

    <Feature Id="ProductFeature" Title="TPI SOFT" Level="1">
      <ComponentGroupRef Id="ProductComponents" />
      <ComponentGroupRef Id="LibrariesComponents" />
      <ComponentGroupRef Id="CustomFonts" />
      <ComponentRef Id="CMP_MenuShortcut" />
      <ComponentRef Id="CMP_DesktopShortcut" />
    </Feature>

    <Property Id="ARPPRODUCTICON"
              Value="icon.ico" />

    <Property Id="ARPCONTACT"
              Value="My Contact"/>

    <PropertyRef Id="NETFRAMEWORK45"/>
    <Condition Message="Ce logiciel requiert l'installation préalable de Microsoft .NET Framework 4.5 ou plus.">
      <![CDATA[Installed OR NETFRAMEWORK45]]>
    </Condition>

    <Condition Message="Ce logiciel tourne sur tous les systèmes Windows à partir de Windows Vista">
      <![CDATA[Installed OR VersionNT >= 600]]>
    </Condition>

    <Property Id="WIXUI_INSTALLDIR" Value="APPLICATIONFOLDER" />
    <UIRef Id="WixUI_InstallDir" />

    <WixVariable Id="WixUILicenseRtf"
                 Value="$(var.InstallFolderPath)licence.rtf" />

    <WixVariable Id="WixUIDialogBmp"
                 Value="$(var.InstallFolderPath)dialog_bmp.bmp"/>

    <WixVariable Id="WixUIBannerBmp"
                 Value="$(var.InstallFolderPath)	op_banner.bmp"/>

    <Property Id="ApplicationFolderName"
              Value="MyAppMyApp" />

    <Property Id="WixAppFolder"
              Value="WixPerMachineFolder" />

  </Product>

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="COMPANYFOLDER" Name="My Company">
          <Directory Id="APPLICATIONFOLDER" Name="My App 1.0.0">
          </Directory>
        </Directory>
      </Directory>

      <Directory Id="ProgramMenuFolder">
        <Directory Id="MyStartMenuShortcutDir"
                   Name="My App"/>
      </Directory>

      <Directory Id="DesktopFolder">

      </Directory>

      <Directory Id="FontsFolder">

      </Directory>
    </Directory>
  </Fragment>

  <Fragment>
    <ComponentGroup Id="ProductComponents" Directory="APPLICATIONFOLDER">
      <Component Id="cmp436C9F728138518252041AF1E09808A9" Guid="PUT-GUID-HERE">
        <File Id="filC9EEE3E54616B953432FF36EDA3020A3" KeyPath="yes" Source="$(var.MyApp.TargetDir)MyApp.exe" />
      </Component>
      <Component Id="cmp840D318334E734AB5C8FA4C807C4CB95" Guid="PUT-GUID-HERE">
        <File Id="filE698BF079DEBA8E2BC7F2E69833E372D" KeyPath="yes" Hidden="yes" Source="$(var.MyApp.TargetDir)MyApp.exe.config" />
      </Component>

      <Component Id="CMP_Licence"
                 Guid="558784B2-E92A-4686-95BD-A034E859E8A7">
        <File Id="licence"
              Source="$(var.InstallFolderPath)licence.rtf"
              KeyPath="yes" />
      </Component>
    </ComponentGroup>

    <ComponentGroup Id="CustomFonts" Directory="FontsFolder">
      <Component Id="CMP_DigitalFont"
                 Guid="PUT-GUID-HERE">
          <File Id="digitalFont"
                Source="$(var.FontFolderPath)digital-7.ttf"
                TrueType="yes"
                KeyPath="yes" />
      </Component>
    </ComponentGroup>

    <Component Id="CMP_MenuShortcut"
               Directory="MyStartMenuShortcutDir"
               Guid="PUT-GUID-HERE">

      <Shortcut Id="MenuShortcut"
                Name="MyApp 1.0.0"
                Description="Lance le logiciel MyApp"
                Target="[APPLICATIONFOLDER]MyApp.exe"
                WorkingDirectory="APPLICATIONFOLDER"
                Icon="icon.ico"/>

      <RemoveFolder Id="RemoveMyStartMenuShortcutDir"
                    On="uninstall" />
      <RegistryValue Root="HKCU"
                    Key="SoftwareMyApp"
                    Name="installed"
                    Type="integer"
                    Value="2"
                    KeyPath="yes" />
    </Component>

    <Component Id="CMP_DesktopShortcut"
               Directory="DesktopFolder"
               Guid="PUT-GUID-HERE">
      <Shortcut Id="DesktopShortcut"
                Name="MyApp 1.0.0"
                Description="Lance le logiciel MyApp"
                Target="[APPLICATIONFOLDER]MyApp.exe"
                WorkingDirectory="APPLICATIONFOLDER"
                Icon="icon.ico"/>
      <RemoveFolder Id="DesktopFolder" On="uninstall"/>
      <RegistryValue
                 Root="HKCU"
                 Key="SoftwareMyApp"
                 Name="installed"
                 Type="integer"
                 Value="1"
                 KeyPath="yes"/>
    </Component>

  </Fragment>
</Wix>

推荐答案

更新:问题是过时的配置文件中缺少应用程序参数.一个换句话说,配置问题.通过将调试器附加到启动应用程序找到.见下文.

UPDATE: The issue was a missing application parameter in an outdated config file. A configuration issue in other words. Found by attaching debugger to the launching app. See below.

<小时>

日志记录:您是否在 事件查看器 或您的应用程序提供的任何其他日志记录结构中看到任何线索?也许您可以通过应用程序的配置文件或注册表设置启用调试日志记录?


Logging: Do you see any clues in the event viewer or whatever other logging constructs your application provides? Maybe you can enable debug logging for the application via its configuration files or registry settings?

启动问题清单:我写了 应用程序启动问题的通用检查列表.也许看看有什么东西在敲响.

Launch Problems Check-List: I wrote a general-purpose check-list for application launch problems at one point. Maybe have a look and see if something rings a bell.

调试二进制文件 - 启动序列调试:您可以在应用程序启动序列和滑流的早期插入一个消息框调试二进制文件到您的设置中,安装它,然后附加启动时调试器到应用程序的消息框,以便单步执行通过启动代码?(设置断点).

Debug Binaries - Launch Sequence Debugging: You could insert a message box early in your application launch sequence and slipstream the debug binaries into your setup, install it, and then attach the debugger to the application's message box on launch in order to step through the launch code? (set a breakpoint).

  • Maybe check this nice Advanced Installer Video Tutorial for this "attach debugger approach". It shows the same approach for custom action code. The procedure is the same for launching applications. Just attach to message box and set breakpoints.

注意:显然,一旦您知道问题所在,请记住使用发布二进制文件重新编译 - 并重新测试启动.调试二进制文件不可再分发 - 它们仅绑定到调试 dll由 MS SDK 安装.普通 PC 不会(通常)有这些调试 dll(使这个过程主要是关于配置问题,而不是关于运行时依赖问题).

Note: Obviously remember to recompile with the release binaries once you know what the problem is - and retest launching. Debug binaries are not redistributable - they bind to debug dlls only installed by the MS SDK. Normal PCs will not (normally) have these debug dlls (making this procedure primarily about configuration problems and not about runtime dependency issues).

更新的免责声明:

免责声明:虽然很明显,但必须提及:切勿将调试二进制文件用于实际发布.1) 完全不合法,2) 由于透明度原因,这不是一个好主意和调试二进制文件的逆向工程可能性,以及 3) 调试运行时二进制文件将不存在于非开发人员的机器上(并且不要试图静态链接).最后:它当您像这样进行调试时,很容易忘记使用发布二进制文件进行重建.它肯定会发生.

Disclaimer: Though obvious, it has to be mentioned: never use debug binaries for actual release. 1) Not at all legal, 2) not a good idea due to the transparency and reverse-engineering possibilities of debug binaries, and 3) debug runtime binaries will not exist on non-developer boxes (and don't be tempted to statically link). And finally: it could be easy to forget to rebuild with release binaries when you mess around with debugging like this. It sure happens.

<小时>

类似答案:我不会在这里重复自己,而是链接到之前的一些类似答案.请浏览此内容,看看您是否看到任何响铃的东西:


Similar Answers: Rather than repeating myself here, I will link to a few similar answers from earlier. Please skim this to see if you see anything that rings a bell:

这篇关于wix c# 应用程序在安装后无法启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆