- Added scripts to rename and copy the MSI installer to the $(SolutionDir)\Release folder

- Added conditional post build to run the build-relport script when building the Release Portable configuration
This commit is contained in:
David Sparer
2016-06-20 11:52:01 -06:00
parent c6b079c9cb
commit 23eaba0d47
4 changed files with 59 additions and 7 deletions

View File

@@ -100,6 +100,7 @@
</LinkerAdditionalOptions>
<DefineConstants>HarvestPath=$(SolutionDir)mRemoteV1\bin\Release;HelpFilesHarvestPath=$(SolutionDir)mRemoteV1\Resources\Help</DefineConstants>
<Cultures>en-US</Cultures>
<SuppressPdbOutput>True</SuppressPdbOutput>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<Cultures>en-US</Cultures>
@@ -112,13 +113,27 @@
<DefineConstants>HarvestPath=$(SolutionDir)mRemoteV1\bin\Release Portable;HelpFilesHarvestPath=$(SolutionDir)mRemoteV1\Resources\Help</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<PreBuildEvent>REM Harvest bin directory of the mRemoteV1 project
<PostBuildEvent>set /p buildenv=&lt;buildenv.tmp
REM Sign MSI
IF EXIST C:\mRemoteNG_code_signing_cert.pfx (powershell "&amp;""$(SolutionDir)Tools\signfiles.ps1""" %27%25cd%25%27)
REM Rename MSI to include version number
powershell "&amp;""$(SolutionDir)Tools\rename_installer_with_version.ps1""" %27$(SolutionDir)%27 %27!(TargetPath)%27
REM Copy MSI to Release folder
IF %25buildenv: Portable=%25==Release (powershell "&amp;""$(SolutionDir)Tools\copy_release_installer.ps1""" %27$(TargetDir)%27 %27$(SolutionDir)Release%27)</PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PreBuildEvent>REM Clean the TargetDir
rmdir /S /Q "$(TargetDir)"
echo $(ConfigurationName) &gt; buildenv.tmp
REM Harvest bin directory of the mRemoteV1 project
call "$(WIX)bin\heat.exe" dir "$(SolutionDir)mRemoteV1\bin\$(Configuration)" -ag -dr APPLICATIONROOTDIRECTORY -var var.HarvestPath -srd -cg MandatoryComponents -template fragment -out "$(ProjectDir)Fragments\FilesFragment.wxs" -t "$(ProjectDir)Filters\Harvest_Filter.xslt" -v
REM Convert the license file "COPYING.TXT" to "License.rtf" to be shown in the installer GUI
call "$(ProjectDir)Resources\Pandoc\pandoc.exe" -s -t rtf -o "$(ProjectDir)\Resources\License.rtf" "$(SolutionDir)COPYING.TXT"</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>REM Sign MSI
IF EXIST C:\mRemoteNG_code_signing_cert.pfx (powershell "&amp;""$(SolutionDir)signfiles.ps1""" "%25cd%25")</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,13 @@
$sourcePath = $args[0]
$destinationDir = $args[1]
if (!(Test-Path -Path $destinationDir))
{
New-Item -Path $destinationDir -ItemType "directory"
}
$sourceFiles = Get-ChildItem -Path $sourcePath -Recurse | ?{$_.Extension -match "exe|msi"}
foreach ($item in $sourceFiles)
{
Copy-Item -Path $item.FullName -Destination $destinationDir -Force
}

View File

@@ -0,0 +1,21 @@
#$solutionDir = $args[0] -replace "\\$"
$solutionDir = "C:\Users\vsparda\Documents\Repositories\mRemoteNG Project\mRemoteNG\"
#$renameTarget = $args[1]
$renameTarget = "C:\Users\vsparda\Documents\Repositories\mRemoteNG Project\mRemoteNG\InstallerProjects\Installer\bin\Release\en-US\mRemoteNG-Installer.msi"
$targetVersionedFile = "$solutionDir\mRemoteV1\bin\Release\mRemoteNG.exe"
$version = &"$solutionDir\Tools\sigcheck.exe" /accepteula -q -n $targetVersionedFile
$renameTargetFileObject = Get-Item -Path $renameTarget -ErrorAction SilentlyContinue
if ($renameTargetFileObject)
{
# Build the new file name
$oldFileName = $renameTargetFileObject.Name
$newFileName = $oldFileName -replace "$("\"+$renameTargetFileObject.Extension)",$("-"+$version+$renameTargetFileObject.Extension)
# Delete any items that already exist with the new name (effectively an overwrite)
Remove-Item -Path "$($renameTargetFileObject.Directory.FullName)\$newFileName" -ErrorAction SilentlyContinue
# Rename file
Rename-Item -Path $renameTarget -NewName $newFileName -ErrorAction SilentlyContinue
}

View File

@@ -1203,13 +1203,16 @@ REM Set LargeAddressAware on binary
editbin /largeaddressaware mRemoteNG.exe
REM Sign binaries
IF EXIST C:\mRemoteNG_code_signing_cert.pfx (powershell "&amp;""$(SolutionDir)signfiles.ps1""" %25cd%25)
IF EXIST C:\mRemoteNG_code_signing_cert.pfx (powershell "&amp;""$(SolutionDir)Tools\signfiles.ps1""" '%25cd%25')
REM Remove unnecessary files from Release versions
IF %25buildenv: Portable=%25==Release (
rmdir /s /q app.publish
del /q *.pdb *.publish *.xml *.backup *.log *vshost* *.tmp
)</PostBuildEvent>
)
REM Package ZIP if building Release Portable
IF %25buildenv: =%25==ReleasePortable ("$(SolutionDir)build-relport.cmd")</PostBuildEvent>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>