Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions assets/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,8 @@
<!-- Embed Cabinet Files in Product-->
<MediaTemplate EmbedCab="yes" />

<!-- In Your Wix Setup Project, Add A Reference To WixUIExtension.dll -->
<!-- This is a minimal User Interface. In fact, it only displays a license -->
<!-- acceptance dialog. It doesn’t do anything else except provide -->
<!-- basic status during installation. -->
<UIRef Id="WixUI_Minimal" />
<!-- In Your Wix Setup Project, Add A Reference To WixUIExtension.dll -->
<UIRef Id="WixUI_InstallDir" />

<!-- Features are mandatory. Need At Least One. -->
<Feature Id="ProductFeature" Title="PowerShell" Level="1">
Expand All @@ -49,8 +46,8 @@
<ComponentRef Id="ApplicationProgramsMenuShortcut"/>
</Feature>

<!--We need to show EULA, but not provide option to customize download location-->
<Property Id="WixUI_Minimal" Value="$(var.ProductVersionWithName)" />
<!--We need to show EULA, and provide option to customize download location-->
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />

<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
Expand Down
48 changes: 34 additions & 14 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ function Start-PSBuild {

# handle xaml files
# Heuristic to resolve xaml on the fresh machine
if ($FullCLR -and ($XamlGen -or -not (Test-Path "$PSScriptRoot/src/Microsoft.PowerShell.Activities/gen/*.g.resources")))
if ($FullCLR -and ($XamlGen -or -not (Test-Path "$PSScriptRoot/src/Microsoft.PowerShell.Activities/gen/*.g.cs")))
{
log "Run XamlGen (generating .g.cs and .resources for .xaml files)"
Start-XamlGen -MSBuildConfiguration $msbuildConfiguration
Expand Down Expand Up @@ -1334,6 +1334,36 @@ internal class {0} {{
return $resultCode -replace "`r`n?|`n","`r`n"
}

# Builds coming out of this project can have version number as 'a.b.c' OR 'a.b.c-d-f'
# This function converts the above version into major.minor[.build[.revision]] format
function Get-PackageVersionAsMajorMinorBuildRevision
{
[CmdletBinding()]
param (
# Version of the Package
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string] $Version
)

Write-Verbose "Extract the version in the form of major.minor[.build[.revision]] for $Version"
$packageVersionTokens = $Version.Split('-')
$packageVersion = ([regex]::matches($Version, "\d+(\.\d+)+"))[0].value

if (1 -eq $packageVersionTokens.Count)
{
# In case the input is of the form a.b.c, add a '0' at the end for revision field
$packageVersion = $packageVersion + '.0'
}
elseif (1 -lt $packageVersionTokens.Count)
{
# We have all the four fields
$packageVersion = $packageVersion + '.' + $packageVersionTokens[1]
}

return $packageVersion
}

function New-MSIPackage
{
[CmdletBinding()]
Expand Down Expand Up @@ -1381,12 +1411,7 @@ function New-MSIPackage
$wixCandleExePath = Join-Path $wixToolsetBinPath "Candle.exe"
$wixLightExePath = Join-Path $wixToolsetBinPath "Light.exe"

Write-Verbose "Extract the version in the form of a.b.c.d for $ProductVersion"
$ProductVersionTokens = $ProductVersion.Split('-')
$ProductVersion = ([regex]::matches($ProductVersion, "\d+(\.\d+)+"))[0].value

# Need to add the last version field for makeappx
$ProductVersion = $ProductVersion + '.' + $ProductVersionTokens[1]
$ProductVersion = Get-PackageVersionAsMajorMinorBuildRevision -Version $ProductVersion -Verbose

$assetsInSourcePath = "$ProductSourcePath" + '\assets'
New-Item $assetsInSourcePath -type directory -Force | Write-Verbose
Expand Down Expand Up @@ -1447,13 +1472,8 @@ function New-AppxPackage
[ValidateNotNullOrEmpty()]
[string] $AssetsPath
)

Write-Verbose "Extract the version in the form of a.b.c.d for $PackageVersion"
$PackageVersionTokens = $PackageVersion.Split('-')
$PackageVersion = ([regex]::matches($PackageVersion, "\d+(\.\d+)+"))[0].value

# Need to add the last version field for makeappx
$PackageVersion = $PackageVersion + '.' + $PackageVersionTokens[1]

$PackageVersion = Get-PackageVersionAsMajorMinorBuildRevision -Version $PackageVersion -Verbose
Write-Verbose "Package Version is $PackageVersion"

$win10sdkBinPath = "${env:ProgramFiles(x86)}\Windows Kits\10\bin\x64"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ private Assembly LoadAssemblyHelper(string assemblyName)
// First try by strong name
try
{
loadedAssembly = ClrFacade.Load(new AssemblyName(assemblyName));
loadedAssembly = Assembly.Load(new AssemblyName(assemblyName));
}
// Generates a FileNotFoundException if you can't load the strong type.
// So we'll try from the short name.
Expand Down Expand Up @@ -2050,7 +2050,7 @@ private Assembly LoadAssemblyHelper(string assemblyName)
// First try by strong name
try
{
loadedAssembly = ClrFacade.Load(assemblyName);
loadedAssembly = Assembly.Load(assemblyName);
}
// Generates a FileNotFoundException if you can't load the strong type.
// So we'll try from the short name.
Expand All @@ -2062,7 +2062,7 @@ private Assembly LoadAssemblyHelper(string assemblyName)
// Next, try an exact match
if (StrongNames.Value.ContainsKey(assemblyName))
{
return ClrFacade.Load(StrongNames.Value[assemblyName]);
return Assembly.Load(StrongNames.Value[assemblyName]);
}

// If the assembly name doesn't contain wildcards, return null. The caller generates an error here.
Expand Down Expand Up @@ -2105,7 +2105,7 @@ private Assembly LoadAssemblyHelper(string assemblyName)
return null;

// Otherwise, load the assembly.
return ClrFacade.Load(matchedStrongName);
return Assembly.Load(matchedStrongName);
}

private static ConcurrentDictionary<string, string> InitializeStrongNameDictionary()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Runtime.CompilerServices;
using System.Reflection;
[assembly:InternalsVisibleTo("System.Management.Automation,PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
[assembly:InternalsVisibleTo("powershell,PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
[assembly:AssemblyFileVersionAttribute("1.0.0.0")]
[assembly:AssemblyVersion("1.0.0.0")]
Loading