【问题标题】:How do I fix error LGHT0094 when using SBT Native Packager?使用 SBT Native Packager 时如何修复错误 LGHT0094?
【发布时间】:2015-12-30 07:03:18
【问题描述】:

我最近才开始使用 SBT Native Packager(版本 1.0.4 和 1.0.5-M3)。每当我跑步时:

windows:packageBin

我收到以下错误:

错误 LGHT0094:未解决在“产品:{98A830B8-2CC3-45EF-93DB-A5701E999432}”部分中对符号“目录:bin97543xxxx”的引用。

wix 文件包含:

  <!-- Define the directories we use -->
  <Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="ProgramMenuFolder">
      <Directory Id="ApplicationProgramsFolder" Name="root"/>
    </Directory>
    <Directory Id="ProgramFilesFolder" Name="PFiles">
      <Directory Id="INSTALLDIR" Name="root">
        <Directory Id="lib107141xxx" Name="lib">

  </Directory><!-- -->
      </Directory>
    </Directory>
  </Directory>
  <!-- Now define the components -->
  <DirectoryRef Id="lib107141xxx">
        <Component Id="nt_root_0_1_0_1c2a7be873a6a59bfeb964353cf0dca4d91eb1af_jar157860110" Guid="41b197e8-de4b-4bf2-a73f-b93f9ab2ffbc">
          <File Id="fl_nt_root_0_1_0_1c2a7be873a6a59bfeb964353cf0dca4d91eb1af_jar157860110" Name="com.example.test-client.root-0.1.0-1c2a7be873a6a59bfeb964353cf0dca4d91eb1af.jar" DiskId="1" Source="lib\com.example.test-client.root-0.1.0-1c2a7be873a6a59bfeb964353cf0dca4d91eb1af.jar">

          </File>
        </Component>
      </DirectoryRef><DirectoryRef Id="lib107141xxx">
        <Component Id="lib_org_scala_lang_scala_library_2_10_5_jar104451402" Guid="7b7c4d4c-947f-4130-b2a9-9c0b9bcc3a50">
          <File Id="fl_lib_org_scala_lang_scala_library_2_10_5_jar104451402" Name="org.scala-lang.scala-library-2.10.5.jar" DiskId="1" Source="lib\org.scala-lang.scala-library-2.10.5.jar">

          </File>
        </Component>
      </DirectoryRef><DirectoryRef Id="bin97543xxxx">
        <Component Id="bin97543xxxxPathC" Guid="11fce8cf-c70c-4335-af67-06a6278c4d78">
          <CreateFolder/>
          <Environment Id="ROOT_HOME" Name="ROOT_HOME" Value="[INSTALLDIR]" Permanent="no" Action="set" System="yes"/>
          <Environment Id="PATH" Name="PATH" Value="[INSTALLDIR]bin" Permanent="no" Part="last" Action="set" System="yes"/>
        </Component>
      </DirectoryRef><DirectoryRef Id="ApplicationProgramsFolder">
        <Component Id="shortcut_d3018014_95df_4633_889a_84d5b605b8bd121149574" Guid="f54458a7-396c-4e45-868d-2fe4b5650d4a">

          <RemoveFolder Id="ApplicationProgramsFolderRemove" Directory="ApplicationProgramsFolder" On="uninstall"/>
          <RegistryValue Root="HKCU" Key="Software\Example.com\root" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
        </Component>
      </DirectoryRef>
  <!-- Now define the features! -->
  <Feature Id="Complete" Title="test-client-windows" Description="Secure Client Windows MSI." Display="expand" Level="1" ConfigurableDirectory="INSTALLDIR">
    <Feature Id="root_core867490596" Title="root" Description="All core files." Level="1" Absent="disallow">
                <ComponentRef Id="nt_root_0_1_0_1c2a7be873a6a59bfeb964353cf0dca4d91eb1af_jar157860110"/><ComponentRef Id="lib_org_scala_lang_scala_library_2_10_5_jar104451402"/>
              </Feature><Feature Id="AddBinToPath" Title="Update Enviornment Variables" Description="Update PATH environment variables (requires restart)." Level="1" Absent="allow">
                <ComponentRef Id="bin97543xxxxPathC"/>
              </Feature><Feature Id="AddConfigLinks" Title="Configuration start menu links" Description="Adds start menu shortcuts to edit configuration files." Level="1" Absent="allow">
                <ComponentRef Id="shortcut_d3018014_95df_4633_889a_84d5b605b8bd121149574"/>
              </Feature>
  </Feature>
  <MajorUpgrade AllowDowngrades="no" Schedule="afterInstallInitialize" DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit."/>
  <UIRef Id="WixUI_FeatureTree"/>
  <UIRef Id="WixUI_ErrorProgressText"/>
  <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"/>


  </Product>
</Wix>

现在我对 SBT Native Packager 或 WiX 不太了解,但我从阅读 DirectoryRef Element 猜测应该有一个对应的 Directory 元素,ID 为 bin97543xxxx,但似乎并不存在。

我快速浏览了WixHelper.scalaWindowsPlugin.scala,但问题可能出在哪里并不是很明显。我想这与WindowsPlugin.scala的以下内容有关:

val addBinToPath =
  // TODO - we may have issues here...
  WindowsFeature(
    id = "AddBinToPath",
    title = "Update Enviornment Variables",
    desc = "Update PATH environment variables (requires restart).",
    components = Seq(AddDirectoryToPath("bin"))
  )

知道如何解决这个问题吗?

【问题讨论】:

  • 我认为这与windows目标目录中不存在的bin目录有关。我没有提供 bat 脚本,makeBatScript 似乎也没有创建它。

标签: scala wix sbt sbt-native-packager


【解决方案1】:

好的,这里的问题是没有创建 bat 脚本。这是因为我有一个多项目构建,而根项目没有主类。

为了解决这个问题,我添加了以下内容:

mainClass in (Compile, batScriptReplacements) <<= (mainClass in (Compile, batScriptReplacements) in mainProject)

mainProject 是具有主类的子项目。

【讨论】:

    猜你喜欢
    • 2021-09-21
    • 2015-10-11
    • 2015-07-25
    • 2016-08-17
    • 2016-12-14
    • 2020-11-07
    • 2013-12-29
    • 2014-01-02
    • 2015-12-22
    相关资源
    最近更新 更多