Skip to content

Commit

Permalink
Remove crossgen'ed IL assemblies and then rename NI assemblies to the…
Browse files Browse the repository at this point in the history
… same as the corresponding IL images. (PowerShell#2484)

* Remove crossgen'ed IL assemblies and then rename NI assemblies to the same as the corresponding IL images.
This is to make sure:
  1. The dependency existence check by powershell.exe will pass for all TPAs.
  2. CoreCLR by default will load the NI images even though it's using names of the IL images.

* Update the comment to make it easy to understand
  • Loading branch information
daxian-dbw committed Oct 18, 2016
1 parent 289e695 commit 1d29d42
Showing 1 changed file with 14 additions and 11 deletions.
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
$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

0 comments on commit 1d29d42

Please sign in to comment.