Hello together,
i would like to create an MSi with the Following Code:
$Version = "0.0.1"
$SourcePath1 = "H:\Powershell\Datenbank Information\out"
$SourcePath2 = "H:\Powershell\Database Restore\out"
$UserInterface = New-InstallerUserInterface -TopBanner (Join-Path $PSScriptRoot '.\Graphic\Banner.png') -WelcomeAndCompletionBackground (Join-Path $PSScriptRoot '.\Graphic\Background.png')
New-Installer -ProductName "Datenbank Tools" -UpgradeCode '1a73a1be-50e6-4e92-af03-586f4a9d9e82' `
-UserInterface $UserInterface -RequiresElevation -Platform 'x64' -Content {
New-InstallerDirectory -PredefinedDirectoryName 'ProgramFilesFolder' -Content {
New-InstallerDirectory -DirectoryName "Datenbank Tools" -Id DBWorkingDir -Content{
New-InstallerFile -id 'databaseinformation' -Source (Join-Path $SourcePath1 'Datenbank Information.exe')
New-InstallerFile -id 'databaserestore' -Source (Join-Path $SourcePath2 'Database Restore.exe')
}
}
New-InstallerDirectory -PredefinedDirectoryName 'DesktopFolder' -Content{
New-InstallerShortcut -WorkingDirectoryId DBWorkingDir -FileId 'databaseinformation' -Name 'Datenbank Informationen' -IconPath (Join-Path 'H:\Powershell\Icons' icons8_database_administrator.ico)
New-InstallerShortcut -WorkingDirectoryId DBWorkingDir -FileId 'databaserestore' -Name 'Datenbank Restore' -IconPath (Join-Path 'H:\Powershell\Icons' icons8_database_restore.ico)
}
} -OutputDirectory (Join-Path $PSScriptRoot "output") -Version $Version `
-AddRemoveProgramsIcon (Join-Path $PSScriptRoot "Graphic\icons8_cydia.ico")`
-Manufacturer "Company"
But when I try to create the MSI i got the Following Error:
New-Installer : Windows Installer XML Toolset Linker version 3.11.1.2318
Copyright (c) .NET Foundation and contributors. All rights reserved.
Updating file information.
H:\Powershell\MSI Installer\output\Datenbank Tools.0.0.1.x64.wxs(25) : error LGHT0369 : Component/@Id='cmp34d8154f6b9446148c064da1d8490b38' has a @Guid value '{D6DA7A87-58EF-5D5F-9DEC-C1D87FA46480}' that duplicates another component
in this package. It is recommended to give each component its own unique GUID.
In H:\Powershell\MSI Installer\installer.ps1:9 Zeichen:1
+ New-Installer -ProductName "Datenbank Tools" -UpgradeCode '1a73a1be-5 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-Installer], Exception
+ FullyQualifiedErrorId : System.Exception,PowerShellToolsPro.Cmdlets.Installer.NewInstallerCommand
The whole MSI File will be compiled when I remove one of the Shortcut line.
The WXS File looks like that for the two Shortcuts:
<Directory Id="DesktopFolder" Name="DesktopFolder">
<Component Id="cmp0a34483cd270419b8a0ed6e5d327518f" Guid="*">
<Shortcut Id="sht7cceb896a8b7481c9f735cf30aa8cea1" Name="Datenbank Informationen" Show="normal" Target="[#databaseinformation]" WorkingDirectory="DBWorkingDir" Icon="ico35565430d29e4e52bac14cbac54010bb" />
<RegistryValue Root="HKCU" Key="Software\Company\Datenbank Tools" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
<Component Id="cmpf083969ba4ec459bab2a9d0fc9f24d03" Guid="*">
<Shortcut Id="sht5d82ea30c8fb4512a2a60a7bb1c48264" Name="Datenbank Restore" Show="normal" Target="[#databaserestore]" WorkingDirectory="DBWorkingDir" Icon="icoa49fd6aa23064665a435f146648a089e" />
<RegistryValue Root="HKCU" Key="Software\Company\Datenbank Tools" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</Directory>
Maybe it’s because of the * at the Guid="*"
Maybe someone had the same idear to create two Shotcuts with one MSI and got it to work.
Best Regards
Stefan