Skip to content
Merged
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
25 changes: 14 additions & 11 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -2437,21 +2437,24 @@ function Start-CrossGen {
Generate-CrossGenAssembly -CrossgenPath $crossGenPath -AssemblyPath $assemblyPath
}

<#
# The latest dotnet.exe from .NET Core 1.1.0 preview packages starts
# to check the existence of all TPA assemblies, including those built
# from local projects (e.g. powershell assemblies). The TPA assemblies
# in '.deps.json' are IL assemblies, so we cannot remove those ILs.
#
Write-Verbose "PowerShell Ngen assemblies have been generated, deleting ILs..." -Verbose
#
# With the latest dotnet.exe, the default load context is only able to load TPAs, and TPA
# only contains IL assembly names. In order to make the default load context able to load
# the NI PS assemblies, we need to replace the IL PS assemblies with the corresponding NI
# PS assemblies, but with the same IL assembly names.
#
Write-Verbose "PowerShell Ngen assemblies have been generated. Deploying ..." -Verbose
foreach ($assemblyName in $psCoreAssemblyList) {
# Remove the IL assembly and its symbols.
$assemblyPath = Join-Path $PublishPath $assemblyName

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a minor naming thing, but can you rename $assemblyPath and $symbolsPath to $assemblyFile and $symbolFile? In my mind, a name that ends in "path" implies that it is a path to a directory, not a file.

@daxian-dbw Dongbo Wang (daxian-dbw) Oct 18, 2016 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By quickly looking at build.psm1, the pattern that *Path points to a file is used in many places, such as $outputBufferFilePath, $wixHeatExePath and $wixCandleExePath, and $AssemblyPath is used in 11 places in Start-CrossGen, all indicating the path to an assembly. We also have 8 cmdlets in powershell having -FilePath parameter. So I think it's fine to use *Path points to either a file or a directory, as long as it's clear in the context.

$symbolsPath = $assemblyPath.Replace(".dll", ".pdb")
Remove-Item $assemblyPath -Force -ErrorAction SilentlyContinue
Remove-Item $symbolsPath -Force -ErrorAction SilentlyContinue
$symbolsPath = [System.IO.Path]::ChangeExtension($assemblyPath, ".pdb")
Remove-Item $assemblyPath -Force -ErrorAction Stop
Remove-Item $symbolsPath -Force -ErrorAction Stop

# Rename the corresponding ni.dll assembly to be the same as the IL assembly
$niAssemblyPath = [System.IO.Path]::ChangeExtension($assemblyPath, "ni.dll")
Rename-Item $niAssemblyPath $assemblyPath -Force -ErrorAction Stop
}
#>
}

# Cleans the PowerShell repo
Expand Down