{"action":"created","issue":{"url":"https://api.github.com/repos/sbt/sbt-native-packager/issues/781","repository_url":"https://api.github.com/repos/sbt/sbt-native-packager","labels_url":"https://api.github.com/repos/sbt/sbt-native-packager/issues/781/labels{/name}","comments_url":"https://api.github.com/repos/sbt/sbt-native-packager/issues/781/comments","events_url":"https://api.github.com/repos/sbt/sbt-native-packager/issues/781/events","html_url":"https://github.com/sbt/sbt-native-packager/issues/781","id":149373571,"number":781,"title":"Adding shortcut via wixFeatures results in duplicated primary key in RemoveFile","user":{"login":"smoes","id":6437780,"avatar_url":"https://avatars.githubusercontent.com/u/6437780?v=3","gravatar_id":"","url":"https://api.github.com/users/smoes","html_url":"https://github.com/smoes","followers_url":"https://api.github.com/users/smoes/followers","following_url":"https://api.github.com/users/smoes/following{/other_user}","gists_url":"https://api.github.com/users/smoes/gists{/gist_id}","starred_url":"https://api.github.com/users/smoes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smoes/subscriptions","organizations_url":"https://api.github.com/users/smoes/orgs","repos_url":"https://api.github.com/users/smoes/repos","events_url":"https://api.github.com/users/smoes/events{/privacy}","received_events_url":"https://api.github.com/users/smoes/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/sbt/sbt-native-packager/labels/windows","name":"windows","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-19T07:33:22Z","updated_at":"2016-04-20T08:06:51Z","closed_at":null,"body":"When trying to add a shortcut using `wixFeatures`I get the error from light:\r\n\r\n    The primary key 'ApplicationProgramsFolderRemove' is duplicated in table 'RemoveFile'\r\n\r\nHere is the important snippet from build.scala:\r\n\r\n```scala\r\n // Adding the bat file explicitly as mentioned in the documentation\r\n mappings in Windows <<= (sourceDirectory in Windows) map { (dir) =>\r\n   Seq((dir / \"my.bat\") -> \"bin/my.bat\")\r\n},\r\n\r\n// Adding the wanted wixFeature:\r\n wixFeatures += WindowsFeature(\r\n    id = \"shortcuts\",\r\n    title = \"Shortcuts in start menu\",\r\n    desc = \"Add shortcuts for execution and uninstall in start menu\",\r\n    components = Seq(\r\n      AddShortCuts(Seq(\"bin/my.bat\"))\r\n    )\r\n)\r\n```\r\n\r\nAm I doing something wrong or is that a bug?\r\nUsing WiX toolchain v3.5 at the moment. "},"comment":{"url":"https://api.github.com/repos/sbt/sbt-native-packager/issues/comments/212316270","html_url":"https://github.com/sbt/sbt-native-packager/issues/781#issuecomment-212316270","issue_url":"https://api.github.com/repos/sbt/sbt-native-packager/issues/781","id":212316270,"user":{"login":"smoes","id":6437780,"avatar_url":"https://avatars.githubusercontent.com/u/6437780?v=3","gravatar_id":"","url":"https://api.github.com/users/smoes","html_url":"https://github.com/smoes","followers_url":"https://api.github.com/users/smoes/followers","following_url":"https://api.github.com/users/smoes/following{/other_user}","gists_url":"https://api.github.com/users/smoes/gists{/gist_id}","starred_url":"https://api.github.com/users/smoes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smoes/subscriptions","organizations_url":"https://api.github.com/users/smoes/orgs","repos_url":"https://api.github.com/users/smoes/repos","events_url":"https://api.github.com/users/smoes/events{/privacy}","received_events_url":"https://api.github.com/users/smoes/received_events","type":"User","site_admin":false},"created_at":"2016-04-20T08:06:51Z","updated_at":"2016-04-20T08:06:51Z","body":"Thank you @muuki88 for the fast response.\r\n\r\nI am not too familiar with WiX. However, it seems like this is a bug in the plugin itself. I suppose that there is always one `AddShortCuts` processed in `makeComponentInfo`, no matter if there is one explicitly added or not. This always appears in the corresponding .wix file as follows:\r\n\r\n    <DirectoryRef Id=\"ApplicationProgramsFolder\">\r\n      <Component Id=\"shortcut_d074a9b9_045a_4f82_9363_7cc797820d6b177694507\" Guid=\"aeb3fd7b-e20f-421d-ab49-0f82c48de7c0\">\r\n        <!-- Shortcut would be here, but no targets defined -->   \r\n        <RemoveFolder Id=\"ApplicationProgramsFolderRemove\" Directory=\"ApplicationProgramsFolder\" On=\"uninstall\"/>\r\n         <RegistryValue Root=\"HKCU\" Key=\"Software\\active-group &lt;someofus@active-group.de&gt;\\equals-web\" Name=\"installed\" Type=\"integer\" Value=\"1\" KeyPath=\"yes\"/>\r\n       </Component>\r\n    </DirectoryRef>\r\n\r\nIf an explicit `AddShortCuts` is defined in the settings, the code is executed twice, one generating the above empty structure and another generating the following code (which is what we want because it actually contains a shortcut ;) ):\r\n\r\n    <DirectoryRef Id=\"ApplicationProgramsFolder\">\r\n      <Component Id=\"shortcut_695afaf8_76c7_4c4c_9699_5f193789c13d699030304\" Guid=\"e063ab3a-8ecd-4c21-916c-96e4c036d35a\">\r\n        <Shortcut Id=\"shortcut_695afaf8_76c7_4c4c_9699_5f193789c13d699030304_SC1\" Name=\"my_bat\" Description=\"Edit configuration file: my.bat\" Target=\"[INSTALLDIR]\\bin\\my.bat\" WorkingDirectory=\"INSTALLDIR\"/>\r\n        <RemoveFolder Id=\"ApplicationProgramsFolderRemove\" Directory=\"ApplicationProgramsFolder\" On=\"uninstall\"/>\r\n        <RegistryValue Root=\"HKCU\" Key=\"Software\\active-group &lt;someofus@active-group.de&gt;\\equals-web\" Name=\"installed\" Type=\"integer\" Value=\"1\" KeyPath=\"yes\"/>\r\n      </Component>\r\n    </DirectoryRef>\r\n\r\nHowever, such a snippet should not appear twice in the WiX-file and that causes the conflict. Why the generating code is called twice, I can not say. "}}