Add wix localization (#255)
* add icon to ARP * post build works with french * add postbuild script to generate and embed transforms * add comments to script and combine for loops * add localization with placeholder strings
This commit is contained in:
Родитель
564c43a19f
Коммит
62cf3fb857
|
@ -28,6 +28,8 @@
|
|||
<OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
|
||||
<IntermediateOutputPath>obj\$(Platform)\$(Configuration)\</IntermediateOutputPath>
|
||||
<SuppressValidation>True</SuppressValidation>
|
||||
<Cultures>
|
||||
</Cultures>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Product.wxs" />
|
||||
|
@ -48,11 +50,27 @@
|
|||
<Name>WixUIExtension</Name>
|
||||
</WixExtension>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="en-us.wxl" />
|
||||
<EmbeddedResource Include="fr-fr.wxl" />
|
||||
<EmbeddedResource Include="pt-pt.wxl" />
|
||||
<EmbeddedResource Include="de-de.wxl" />
|
||||
<EmbeddedResource Include="es-es.wxl" />
|
||||
<EmbeddedResource Include="it-it.wxl" />
|
||||
<EmbeddedResource Include="ja-jp.wxl" />
|
||||
<EmbeddedResource Include="ko-kr.wxl" />
|
||||
<EmbeddedResource Include="ru-ru.wxl" />
|
||||
<EmbeddedResource Include="zh-cn.wxl" />
|
||||
<EmbeddedResource Include="zh-tw.wxl" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
|
||||
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
|
||||
<Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
|
||||
</Target>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>powershell $(ProjectDir)postbuild.ps1 %27$(ProjectDir)%27 %27$(WixExtDir)%27 %27$(TargetDir)%27 %27$(TargetName)%27 %27$(ProjectPath)%27</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!--
|
||||
To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Wix.targets.
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
||||
<Product Id="*" Name="MSIX Core" Language="1033" Version="!(bind.FileVersion.MsixMgrExe)" Manufacturer="Microsoft" UpgradeCode="2fe180f8-3fb8-48a0-b01e-68f47fc0ec34">
|
||||
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
|
||||
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Languages="1033,1031,1034,1036,1040,1041,1042,2070,1049,2052,1028"/>
|
||||
|
||||
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
|
||||
<MediaTemplate EmbedCab="yes" />
|
||||
|
@ -78,10 +78,10 @@
|
|||
<UI>
|
||||
<!-- Based off of the Maintenance dialog, we only allow Remove; we only show this dialog to warn of msixmgr apps that need to be removed-->
|
||||
<Dialog Id="RemoveConfirmationDlg" Width="370" Height="270" Title="!(loc.MaintenanceTypeDlg_Title)">
|
||||
<Control Id="RemoveButton" Type="PushButton" X="40" Y="171" Width="80" Height="17" ToolTip="!(loc.MaintenanceTypeDlgRemoveButtonTooltip)" Text="&Remove Anyway">
|
||||
<Control Id="RemoveButton" Type="PushButton" X="40" Y="171" Width="80" Height="17" ToolTip="!(loc.MaintenanceTypeDlgRemoveButtonTooltip)" Text="!(loc.MaintenanceTypeDlgRemoveButton)">
|
||||
<Publish Property="WixUI_InstallMode" Value="Remove">1</Publish>
|
||||
</Control>
|
||||
<Control Id="WarningText" Type="Text" X="40" Y="81" Width="280" Height="40" NoPrefix="yes" Text="{\WixUI_Font_Title}Warning - removing this will cause the following app(s) installed by this to be unremovable: [MSIXMGR_PRODUCTS]. These app(s) should be removed before proceeding" Hidden="yes">
|
||||
<Control Id="WarningText" Type="Text" X="40" Y="81" Width="280" Height="40" NoPrefix="yes" Text="{\WixUI_Font_Title}!(loc.OrphanedPackageWarning)" Hidden="yes">
|
||||
<Condition Action="show">MSIXMGR_PRODUCTS</Condition>
|
||||
</Control>
|
||||
<Control Id="RemoveText" Type="Text" X="60" Y="191" Width="280" Height="20" NoPrefix="yes" Text="!(loc.MaintenanceTypeDlgRemoveText)">
|
||||
|
@ -92,7 +92,7 @@
|
|||
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.MaintenanceTypeDlgBannerBitmap)" />
|
||||
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
|
||||
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
|
||||
<Control Id="Title" Type="Text" X="15" Y="6" Width="340" Height="15" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Title}Remove Installation" />
|
||||
<Control Id="Title" Type="Text" X="15" Y="6" Width="340" Height="15" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Title}!(loc.MaintenanceTypeDlgRemoveButtonTooltip)" />
|
||||
<Control Id="Description" Type="Text" X="25" Y="23" Width="340" Height="20" Transparent="yes" NoPrefix="yes" Text="!(loc.MaintenanceTypeDlgDescription)" />
|
||||
</Dialog>
|
||||
<InstallUISequence>
|
||||
|
@ -148,6 +148,7 @@
|
|||
<!-- ARPNOREPAIR+ARPNOREMOVE are specified to force the MODIFY verb, which will display maintenance UI as the only option in Add/remove Programs-->
|
||||
<Property Id="ARPNOREPAIR" Value="1" />
|
||||
<Property Id="ARPNOREMOVE" Value="1" />
|
||||
<Property Id="ARPPRODUCTICON" Value="MsixIcon" />
|
||||
</UI>
|
||||
|
||||
<UIRef Id="WixUI_Common" />
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
' Windows Installer utility to add a transform or nested database as a substorage
|
||||
' For use with Windows Scripting Host, CScript.exe or WScript.exe
|
||||
' Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
' Demonstrates the use of the database _Storages table
|
||||
'
|
||||
Option Explicit
|
||||
|
||||
Const msiOpenDatabaseModeReadOnly = 0
|
||||
Const msiOpenDatabaseModeTransact = 1
|
||||
Const msiOpenDatabaseModeCreate = 3
|
||||
|
||||
Const msiViewModifyInsert = 1
|
||||
Const msiViewModifyUpdate = 2
|
||||
Const msiViewModifyAssign = 3
|
||||
Const msiViewModifyReplace = 4
|
||||
Const msiViewModifyDelete = 6
|
||||
|
||||
Const ForAppending = 8
|
||||
Const ForReading = 1
|
||||
Const ForWriting = 2
|
||||
Const TristateTrue = -1
|
||||
|
||||
' Check arg count, and display help if argument not present or contains ?
|
||||
Dim argCount:argCount = Wscript.Arguments.Count
|
||||
If argCount > 0 Then If InStr(1, Wscript.Arguments(0), "?", vbTextCompare) > 0 Then argCount = 0
|
||||
If (argCount = 0) Then
|
||||
Wscript.Echo "Windows Installer database substorage managment utility" &_
|
||||
vbNewLine & " 1st argument is the path to MSI database (installer package)" &_
|
||||
vbNewLine & " 2nd argument is the path to a transform or database to import" &_
|
||||
vbNewLine & " If the 2nd argument is missing, substorages will be listed" &_
|
||||
vbNewLine & " 3rd argument is optional, the name used for the substorage" &_
|
||||
vbNewLine & " If the 3rd arugment is missing, the file name is used" &_
|
||||
vbNewLine & " To remove a substorage, use /D or -D as the 2nd argument" &_
|
||||
vbNewLine & " followed by the name of the substorage to remove" &_
|
||||
vbNewLine &_
|
||||
vbNewLine & "Copyright (C) Microsoft Corporation. All rights reserved."
|
||||
Wscript.Quit 1
|
||||
End If
|
||||
|
||||
' Connect to Windows Installer object
|
||||
On Error Resume Next
|
||||
Dim installer : Set installer = Nothing
|
||||
Set installer = Wscript.CreateObject("WindowsInstaller.Installer") : CheckError
|
||||
|
||||
' Evaluate command-line arguments and set open and update modes
|
||||
Dim databasePath:databasePath = Wscript.Arguments(0)
|
||||
Dim openMode : If argCount = 1 Then openMode = msiOpenDatabaseModeReadOnly Else openMode = msiOpenDatabaseModeTransact
|
||||
Dim updateMode : If argCount > 1 Then updateMode = msiViewModifyAssign 'Either insert or replace existing row
|
||||
Dim importPath : If argCount > 1 Then importPath = Wscript.Arguments(1)
|
||||
Dim storageName : If argCount > 2 Then storageName = Wscript.Arguments(2)
|
||||
If storageName = Empty And importPath <> Empty Then storageName = Right(importPath, Len(importPath) - InStrRev(importPath, "\",-1,vbTextCompare))
|
||||
If UCase(importPath) = "/D" Or UCase(importPath) = "-D" Then updateMode = msiViewModifyDelete : importPath = Empty 'substorage will be deleted if no input data
|
||||
|
||||
' Open database and create a view on the _Storages table
|
||||
Dim sqlQuery : Select Case updateMode
|
||||
Case msiOpenDatabaseModeReadOnly: sqlQuery = "SELECT `Name` FROM _Storages"
|
||||
Case msiViewModifyAssign: sqlQuery = "SELECT `Name`,`Data` FROM _Storages"
|
||||
Case msiViewModifyDelete: sqlQuery = "SELECT `Name` FROM _Storages WHERE `Name` = ?"
|
||||
End Select
|
||||
Dim database : Set database = installer.OpenDatabase(databasePath, openMode) : CheckError
|
||||
Dim view : Set view = database.OpenView(sqlQuery)
|
||||
Dim record
|
||||
|
||||
If openMode = msiOpenDatabaseModeReadOnly Then 'If listing storages, simply fetch all records
|
||||
Dim message, name
|
||||
view.Execute : CheckError
|
||||
Do
|
||||
Set record = view.Fetch
|
||||
If record Is Nothing Then Exit Do
|
||||
name = record.StringData(1)
|
||||
If message = Empty Then message = name Else message = message & vbNewLine & name
|
||||
Loop
|
||||
Wscript.Echo message
|
||||
Else 'If adding a storage, insert a row, else if removing a storage, delete the row
|
||||
Set record = installer.CreateRecord(2)
|
||||
record.StringData(1) = storageName
|
||||
view.Execute record : CheckError
|
||||
If importPath <> Empty Then 'Insert storage - copy data into stream
|
||||
record.SetStream 2, importPath : CheckError
|
||||
Else 'Delete storage, fetch first to provide better error message if missing
|
||||
Set record = view.Fetch
|
||||
If record Is Nothing Then Wscript.Echo "Storage not present:", storageName : Wscript.Quit 2
|
||||
End If
|
||||
view.Modify updateMode, record : CheckError
|
||||
database.Commit : CheckError
|
||||
Set view = Nothing
|
||||
Set database = Nothing
|
||||
CheckError
|
||||
End If
|
||||
|
||||
Sub CheckError
|
||||
Dim message, errRec
|
||||
If Err = 0 Then Exit Sub
|
||||
message = Err.Source & " " & Hex(Err) & ": " & Err.Description
|
||||
If Not installer Is Nothing Then
|
||||
Set errRec = installer.LastErrorRecord
|
||||
If Not errRec Is Nothing Then message = message & vbNewLine & errRec.FormatText
|
||||
End If
|
||||
Wscript.Echo message
|
||||
Wscript.Quit 2
|
||||
End Sub
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<WixLocalization Culture="de-de" xmlns="http://schemas.microsoft.com/wix/2006/localization">
|
||||
<String Id="OrphanedPackageWarning">PLACEHOLDER Warning - removing this will cause the following app(s) installed by this to be unremovable: [MSIXMGR_PRODUCTS]. These app(s) should be removed before proceeding</String>
|
||||
</WixLocalization>
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<WixLocalization Culture="en-us" xmlns="http://schemas.microsoft.com/wix/2006/localization">
|
||||
<String Id="OrphanedPackageWarning">Warning - removing this will cause the following app(s) installed by this to be unremovable: [MSIXMGR_PRODUCTS]. These app(s) should be removed before proceeding</String>
|
||||
</WixLocalization>
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<WixLocalization Culture="es-es" xmlns="http://schemas.microsoft.com/wix/2006/localization">
|
||||
<String Id="OrphanedPackageWarning">PLACEHOLDER Warning - removing this will cause the following app(s) installed by this to be unremovable: [MSIXMGR_PRODUCTS]. These app(s) should be removed before proceeding</String>
|
||||
</WixLocalization>
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<WixLocalization Culture="fr-FR" xmlns="http://schemas.microsoft.com/wix/2006/localization">
|
||||
<String Id="OrphanedPackageWarning">PLACEHOLDER Warning - removing this will cause the following app(s) installed by this to be unremovable: [MSIXMGR_PRODUCTS]. These app(s) should be removed before proceeding</String>
|
||||
</WixLocalization>
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<WixLocalization Culture="it-it" xmlns="http://schemas.microsoft.com/wix/2006/localization">
|
||||
<String Id="OrphanedPackageWarning">PLACEHOLDER Warning - removing this will cause the following app(s) installed by this to be unremovable: [MSIXMGR_PRODUCTS]. These app(s) should be removed before proceeding</String>
|
||||
</WixLocalization>
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<WixLocalization Culture="ja-jp" xmlns="http://schemas.microsoft.com/wix/2006/localization">
|
||||
<String Id="OrphanedPackageWarning">PLACEHOLDER Warning - removing this will cause the following app(s) installed by this to be unremovable: [MSIXMGR_PRODUCTS]. These app(s) should be removed before proceeding</String>
|
||||
</WixLocalization>
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<WixLocalization Culture="ko-kr" xmlns="http://schemas.microsoft.com/wix/2006/localization">
|
||||
<String Id="OrphanedPackageWarning">PLACEHOLDER Warning - removing this will cause the following app(s) installed by this to be unremovable: [MSIXMGR_PRODUCTS]. These app(s) should be removed before proceeding</String>
|
||||
</WixLocalization>
|
|
@ -0,0 +1,36 @@
|
|||
# Postbuild script to create a multilanguage msi with embedded transforms
|
||||
# This creates a separate MSI with UI resources for each language by re-running light.exe with different -cultures: flags
|
||||
# Then creates a language-specific transform for each language using WiX tool's torch.exe
|
||||
# Then embeds each transform into the MSI using WiSubStg.vbs which was copied from MSI SDK scripts
|
||||
|
||||
param (
|
||||
[string]$ProjectDir,
|
||||
[string]$WixExtDir,
|
||||
[string]$TargetDir,
|
||||
[string]$TargetName,
|
||||
[string]$ProjectPath
|
||||
)
|
||||
|
||||
$languages = @{ "de-DE" = 1031; "es-ES" = 1034; "fr-FR" = 1036; "it-IT" = 1040; "ja-JP" = 1041; "ko-KR" = 1042; "pt-PT" = 2070; "ru-RU" = 1049; "zh-CN" = 2052; "zh-TW" = 1028 }
|
||||
|
||||
$lightExe = "$wixextdir"+ "Light.exe"
|
||||
$torchExe = "$wixextdir"+ "Torch.exe"
|
||||
$transformEmbedScript = "$ProjectDir\WiSubStg.vbs"
|
||||
$wixUIExtensionDll = $WixExtDir + "WixUIExtension.dll"
|
||||
|
||||
# keep original copy to create transforms off of, and have a combined copy that has all the embedded transforms
|
||||
copy "$TargetDir\en-us\$TargetName.msi" "$TargetDir\$TargetName.msi"
|
||||
|
||||
cd $ProjectDir
|
||||
$languages.GetEnumerator() |% {
|
||||
$language = $_.key
|
||||
$lcid = $_.value
|
||||
|
||||
#generate an msi for each language (this is already handled by the build)
|
||||
#& "$lightExe" -out $TargetDir\$TargetName-$language.msi -cultures:$language -ext "$wixUIExtensionDll" -sval -wixprojectfile $ProjectPath obj\Release\Product.wixobj
|
||||
|
||||
#create language-specific transform - wrong codepage will generate on error, but the package seems to work anyway.
|
||||
& "$torchExe" $TargetDir\en-us\$TargetName.msi $TargetDir\$language\$TargetName.msi -o $TargetDir\$language.mst | out-null
|
||||
#embed transform into the combined msi
|
||||
& "cscript.exe" $transformEmbedScript $TargetDir\$TargetName.msi $TargetDir\$language.mst $lcid
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<WixLocalization Culture="pt-pt" xmlns="http://schemas.microsoft.com/wix/2006/localization">
|
||||
<String Id="OrphanedPackageWarning">PLACEHOLDER Warning - removing this will cause the following app(s) installed by this to be unremovable: [MSIXMGR_PRODUCTS]. These app(s) should be removed before proceeding</String>
|
||||
</WixLocalization>
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<WixLocalization Culture="ru-ru" xmlns="http://schemas.microsoft.com/wix/2006/localization">
|
||||
<String Id="OrphanedPackageWarning">PLACEHOLDER Warning - removing this will cause the following app(s) installed by this to be unremovable: [MSIXMGR_PRODUCTS]. These app(s) should be removed before proceeding</String>
|
||||
</WixLocalization>
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<WixLocalization Culture="zh-cn" xmlns="http://schemas.microsoft.com/wix/2006/localization">
|
||||
<String Id="OrphanedPackageWarning">PLACEHOLDER Warning - removing this will cause the following app(s) installed by this to be unremovable: [MSIXMGR_PRODUCTS]. These app(s) should be removed before proceeding</String>
|
||||
</WixLocalization>
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<WixLocalization Culture="zh-tw" xmlns="http://schemas.microsoft.com/wix/2006/localization">
|
||||
<String Id="OrphanedPackageWarning">PLACEHOLDER Warning - removing this will cause the following app(s) installed by this to be unremovable: [MSIXMGR_PRODUCTS]. These app(s) should be removed before proceeding</String>
|
||||
</WixLocalization>
|
Загрузка…
Ссылка в новой задаче