I just recently started playing around with SBT Native Packager (version 1.0.4 and 1.0.5-M3). Whenever I run:
windows:packageBin
I get the following error:
error LGHT0094 : Unresolved reference to symbol 'Directory:bin97543xxxx' in section 'Product:{98A830B8-2CC3-45EF-93DB-A5701E999432}'.
The wix file contains:
<!-- 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>
Now I don't know very much about SBT Native Packager or WiX but I'm guessing from reading DirectoryRef Element that there should be a corresponding Directory element with id bin97543xxxx
that doesn't seem to be there.
I had a quick look at WixHelper.scala
and WindowsPlugin.scala
but it wasn't very obvious what the problem may have been. I guess it has something to do with the following from 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"))
)
Any idea how to fix this?
Ok so the problem here was that the bat script wasn't being created. This was because I had a multi-project build and the root project didn't have a main class.
To fix this I added the following:
mainClass in (Compile, batScriptReplacements) <<= (mainClass in (Compile, batScriptReplacements) in mainProject)
Where mainProject
was the sub-project that had the main class.