|
| 1 | +<Project Sdk="WixToolset.Sdk/6.0.2"> |
| 2 | + <PropertyGroup> |
| 3 | + <OutputName>FieldWorksOfflineBundle</OutputName> |
| 4 | + <OutputType>Bundle</OutputType> |
| 5 | + <TargetFramework>net48</TargetFramework> |
| 6 | + <EnableDefaultCompileItems>false</EnableDefaultCompileItems> |
| 7 | + |
| 8 | + <!-- Prefer explicit package paths when resolving WixExtension items; otherwise MSBuild's ReferencePaths can |
| 9 | + accidentally bind to older extension DLLs if multiple versions exist under ./packages. --> |
| 10 | + <WixExtensionSearchPaths>{RawFileName};{HintPathFromItem};$(ReferencePaths)</WixExtensionSearchPaths> |
| 11 | + </PropertyGroup> |
| 12 | + |
| 13 | + <PropertyGroup> |
| 14 | + <!-- Defaults for local dev, overridden by Installer.targets --> |
| 15 | + <ApplicationName Condition="'$(ApplicationName)' == ''">FieldWorks</ApplicationName> |
| 16 | + <SafeApplicationName Condition="'$(SafeApplicationName)' == ''">FieldWorks</SafeApplicationName> |
| 17 | + <Manufacturer Condition="'$(Manufacturer)' == ''">SIL International</Manufacturer> |
| 18 | + <SafeManufacturer Condition="'$(SafeManufacturer)' == ''">SIL</SafeManufacturer> |
| 19 | + <BundleId Condition="'$(BundleId)' == ''">$(SafeManufacturer).$(SafeApplicationName)</BundleId> |
| 20 | + <UpgradeCode Condition="'$(UpgradeCode)' == ''">1092269F-9EA1-419B-8685-90203F83E254</UpgradeCode> |
| 21 | + <Year Condition="'$(Year)' == ''">$([System.DateTime]::Now.Year)</Year> |
| 22 | + <MajorVersion Condition="'$(MajorVersion)' == ''">9</MajorVersion> |
| 23 | + <TruncatedVersion Condition="'$(TruncatedVersion)' == ''">$(MajorVersion).0</TruncatedVersion> |
| 24 | + <VersionNumber Condition="'$(VersionNumber)' == ''">$(TruncatedVersion).0.1</VersionNumber> |
| 25 | + |
| 26 | + <DefineConstants>ApplicationName=$(ApplicationName);SafeApplicationName=$(SafeApplicationName);TruncatedVersion=$(TruncatedVersion);VersionNumber=$(VersionNumber);BundleId=$(BundleId);UpgradeCode=$(UpgradeCode);Year=$(Year);Manufacturer=$(Manufacturer);SafeManufacturer=$(SafeManufacturer);$(DefineConstants)</DefineConstants> |
| 27 | + </PropertyGroup> |
| 28 | + |
| 29 | + <ItemGroup> |
| 30 | + <PackageReference Include="WixToolset.Bal.wixext" Version="6.0.2" /> |
| 31 | + <PackageReference Include="WixToolset.Util.wixext" Version="6.0.2" /> |
| 32 | + </ItemGroup> |
| 33 | + |
| 34 | + <ItemGroup> |
| 35 | + <Compile Include="Shared\Base\OfflineBundle.wxs" /> |
| 36 | + </ItemGroup> |
| 37 | + |
| 38 | + <Target Name="StageOfflineBundlePayloads" BeforeTargets="CoreCompile"> |
| 39 | + <PropertyGroup> |
| 40 | + <_BundleCultureDir>$(MSBuildProjectDirectory)\bin\$(Platform)\$(Configuration)\en-US</_BundleCultureDir> |
| 41 | + <_BundleSourceDir>$(_BundleCultureDir)\SourceDir</_BundleSourceDir> |
| 42 | + <_LibsDir>$(MSBuildProjectDirectory)\libs</_LibsDir> |
| 43 | + </PropertyGroup> |
| 44 | + |
| 45 | + <MakeDir Directories="$(_BundleSourceDir)" /> |
| 46 | + |
| 47 | + <Copy SourceFiles="Shared\Base\BundleTheme.xml" DestinationFiles="$(_BundleCultureDir)\BundleTheme.xml" /> |
| 48 | + <Copy SourceFiles="Shared\Base\BundleTheme.wxl" DestinationFiles="$(_BundleCultureDir)\BundleTheme.wxl" /> |
| 49 | + <Copy SourceFiles="Shared\resources\logo.png" DestinationFiles="$(_BundleCultureDir)\fw-logo.png" /> |
| 50 | + <Copy SourceFiles="Shared\resources\bundle_background.bmp" DestinationFiles="$(_BundleCultureDir)\bundle_background.bmp" /> |
| 51 | + <Copy SourceFiles="Shared\resources\License.htm" DestinationFiles="$(_BundleCultureDir)\License.htm" /> |
| 52 | + |
| 53 | + <!-- Offline prerequisites are sourced from the repo-local FLExInstaller\libs folder and embedded into the bundle. --> |
| 54 | + <Copy SourceFiles="$(_LibsDir)\ndp48-x86-x64-allos-enu.exe" DestinationFiles="$(_BundleSourceDir)\ndp48-x86-x64-allos-enu.exe" /> |
| 55 | + <Copy SourceFiles="$(_LibsDir)\vcredist_2008_$(Platform).exe" DestinationFiles="$(_BundleSourceDir)\vcredist_2008_$(Platform).exe" /> |
| 56 | + <Copy SourceFiles="$(_LibsDir)\vcredist_2010_$(Platform).exe" DestinationFiles="$(_BundleSourceDir)\vcredist_2010_$(Platform).exe" /> |
| 57 | + <Copy SourceFiles="$(_LibsDir)\vcredist_2012_$(Platform).exe" DestinationFiles="$(_BundleSourceDir)\vcredist_2012_$(Platform).exe" /> |
| 58 | + <Copy SourceFiles="$(_LibsDir)\vcredist_2013_$(Platform).exe" DestinationFiles="$(_BundleSourceDir)\vcredist_2013_$(Platform).exe" /> |
| 59 | + <Copy SourceFiles="$(_LibsDir)\vcredist_2015-19_$(Platform).exe" DestinationFiles="$(_BundleSourceDir)\vcredist_2015-19_$(Platform).exe" /> |
| 60 | + </Target> |
| 61 | + |
| 62 | + <Target Name="EnsureBundleNotRunning" BeforeTargets="CopyFilesToOutputDirectory"> |
| 63 | + <PropertyGroup> |
| 64 | + <_BundleExeName>$(OutputName)</_BundleExeName> |
| 65 | + </PropertyGroup> |
| 66 | + |
| 67 | + <Message Text="Checking for running $(_BundleExeName).exe processes that may lock $(TargetPath)" Importance="high" /> |
| 68 | + <Exec Command="powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "$targetPath = '$(TargetPath)'; $isLocked = $false; if (Test-Path -LiteralPath $targetPath) { try { $fs = [System.IO.File]::Open($targetPath, [System.IO.FileMode]::Open, [System.IO.FileAccess]::ReadWrite, [System.IO.FileShare]::None); $fs.Close(); } catch { $isLocked = $true; Write-Output ('Bundle output is locked: {0}' -f $targetPath); } }; $procs = @(Get-Process -Name '$(_BundleExeName)' -ErrorAction SilentlyContinue); if ($procs.Count -eq 0) { Write-Output 'No running bundle processes found.' } else { foreach ($p in $procs) { Write-Output ('Found process Id={0} Name={1} Title={2}' -f $p.Id,$p.ProcessName,$p.MainWindowTitle) } }; if ($isLocked) { Write-Output 'Close the running bundle (or run elevated) and retry.'; exit 1 } else { exit 0 }"" /> |
| 69 | + </Target> |
| 70 | + |
| 71 | + <ItemGroup> |
| 72 | + <ProjectReference Include="FieldWorks.Installer.wixproj" /> |
| 73 | + </ItemGroup> |
| 74 | + |
| 75 | + <Target Name="SignBundle" AfterTargets="Build" Condition="'$(SignOutput)'=='true'"> |
| 76 | + <Exec Command="call Shared\Base\signingProxy.bat "$(OutputPath)$(OutputName).exe"" /> |
| 77 | + </Target> |
| 78 | +</Project> |
0 commit comments