@@ -1432,7 +1432,7 @@ function CreateNugetPlatformFolder
14321432 [string ] $PlatformBinPath
14331433 )
14341434
1435- $destPath = New-Item - ItemType Directory - Path (Join-Path $PackageRuntimesFolder " $Platform /lib/netstandard2.0 " )
1435+ $destPath = New-Item - ItemType Directory - Path (Join-Path $PackageRuntimesFolder " $Platform /lib/netcoreapp2.1 " )
14361436 $fullPath = Join-Path $PlatformBinPath $file
14371437
14381438 if (-not (Test-Path $fullPath )) {
@@ -1563,7 +1563,7 @@ function New-UnifiedNugetPackage
15631563 $packageRuntimesFolder = New-Item (Join-Path $filePackageFolder.FullName ' runtimes' ) - ItemType Directory
15641564
15651565 # region ref
1566- $refFolder = New-Item (Join-Path $filePackageFolder.FullName ' ref/netstandard2.0 ' ) - ItemType Directory - Force
1566+ $refFolder = New-Item (Join-Path $filePackageFolder.FullName ' ref/netcoreapp2.1 ' ) - ItemType Directory - Force
15671567 CopyReferenceAssemblies - assemblyName $fileBaseName - refBinPath $refBinPath - refNugetPath $refFolder - assemblyFileList $fileList
15681568 # endregion ref
15691569
@@ -1694,7 +1694,7 @@ function New-UnifiedNugetPackage
16941694}
16951695
16961696<#
1697- Copy the generated reference assemblies to the 'ref/netstandard2.0 ' folder properly.
1697+ Copy the generated reference assemblies to the 'ref/netcoreapp2.1 ' folder properly.
16981698 This is a helper function used by 'New-UnifiedNugetPackage'
16991699#>
17001700function CopyReferenceAssemblies
@@ -1897,6 +1897,7 @@ function New-ReferenceAssembly
18971897
18981898 foreach ($assemblyName in $assemblyNames ) {
18991899
1900+ Write-Log " Building reference assembly for '$assemblyName '"
19001901 $projectFolder = New-Item - Path " $genAPIFolder /$assemblyName " - ItemType Directory - Force
19011902 $generatedSource = Join-Path $projectFolder " $assemblyName .cs"
19021903 $filteredSource = Join-Path $projectFolder " ${assemblyName} _Filtered.cs"
@@ -1918,15 +1919,19 @@ function New-ReferenceAssembly
19181919 {
19191920 Push-Location $projectFolder
19201921
1921- $csProj = GenerateCSProjectContent - AssemblyName $assemblyName - RefAssemblyVersion $RefAssemblyVersion - SnkFilePath $SnkFilePath - SMAReferencePath $SMAReferenceAssembly
1922- $csProj | Out-File - FilePath " $projectFolder /$assemblyName .csproj" - Force
1922+ $sourceProjectRoot = Join-Path $PSScriptRoot ' projects/reference'
1923+ $sourceProjectFile = Join-Path $sourceProjectRoot " $assemblyName .csproj"
1924+ Copy-Item - Path $sourceProjectFile - Destination " $projectFolder /$assemblyName .csproj" - Force
19231925
19241926 Write-Host " ##vso[artifact.upload containerfolder=artifact;artifactname=artifact]$projectFolder /$assemblyName .csproj"
19251927 Write-Host " ##vso[artifact.upload containerfolder=artifact;artifactname=artifact]$generatedSource "
19261928
1927- Start-NativeExecution { dotnet build - c Release }
1929+ $arguments = GenerateBuildArguments - AssemblyName $assemblyName - RefAssemblyVersion $RefAssemblyVersion - SnkFilePath $SnkFilePath - SMAReferencePath $SMAReferenceAssembly
19281930
1929- $refBinPath = Join-Path $projectFolder " bin/Release/netstandard2.0/$assemblyName .dll"
1931+ Write-Log " Running: dotnet $arguments "
1932+ Start-NativeExecution - sb {dotnet $arguments }
1933+
1934+ $refBinPath = Join-Path $projectFolder " bin/Release/netcoreapp2.1/$assemblyName .dll"
19301935 if ($null -eq $refBinPath ) {
19311936 throw " Reference assembly was not built."
19321937 }
@@ -1950,6 +1955,10 @@ function New-ReferenceAssembly
19501955 }
19511956}
19521957
1958+ <#
1959+ Helper function for New-ReferenceAssembly to further clean up the
1960+ C# source code generated from GenApi.exe.
1961+ #>
19531962function CleanupGeneratedSourceCode
19541963{
19551964 param (
@@ -2033,7 +2042,11 @@ function CleanupGeneratedSourceCode
20332042 Write-Log " Code cleanup complete for reference assembly '$assemblyName '."
20342043}
20352044
2036- function GenerateCSProjectContent
2045+ <#
2046+ Helper function for New-ReferenceAssembly to get the arguments
2047+ for building reference assemblies.
2048+ #>
2049+ function GenerateBuildArguments
20372050{
20382051 param (
20392052 [string ] $AssemblyName ,
@@ -2042,21 +2055,18 @@ function GenerateCSProjectContent
20422055 [string ] $SMAReferencePath
20432056 )
20442057
2045- switch ( $assemblyName ) {
2046- " System.Management.Automation " {
2047- $csProj = $packagingStrings . ' System.Management.Automation ' -f $ RefAssemblyVersion, $SnkFilePath
2048- }
2058+ $arguments = @ ( ' build ' )
2059+ $arguments += @ ( ' -c ' , ' Release ' )
2060+ $arguments += " /p:RefAsmVersion= $ RefAssemblyVersion"
2061+ $arguments += " /p:SnkFile= $SnkFilePath "
20492062
2063+ switch ($AssemblyName ) {
20502064 " Microsoft.PowerShell.Commands.Utility" {
2051- $csProj = $packagingStrings .' Microsoft.PowerShell.Commands.Utility' -f $RefAssemblyVersion , $SnkFilePath , $SMAReferencePath
2052- }
2053-
2054- default {
2055- throw " It's not yet supported to generate reference assembly for '$assemblyName '"
2065+ $arguments += " /p:SmaRefFile=$SMAReferencePath "
20562066 }
20572067 }
20582068
2059- return $csProj
2069+ return $arguments
20602070}
20612071
20622072<#
@@ -2205,7 +2215,7 @@ function New-NugetContentPackage
22052215 New-StagingFolder - StagingPath $contentFolder
22062216 }
22072217
2208- $projectFolder = Join-Path $PSScriptRoot - ChildPath ' project '
2218+ $projectFolder = Join-Path $PSScriptRoot ' projects/nuget '
22092219
22102220 $arguments = @ (' pack' )
22112221 $arguments += @ (' --output' , $nugetFolder )
0 commit comments