Fix compat package drop script for 3.0 (dotnet/corefx#31849)
authorSantiago Fernandez Madero <safern@microsoft.com>
Mon, 20 Aug 2018 23:10:59 +0000 (16:10 -0700)
committerGitHub <noreply@github.com>
Mon, 20 Aug 2018 23:10:59 +0000 (16:10 -0700)
Commit migrated from https://github.com/dotnet/corefx/commit/a3265295c4c0f6634444f77beb9d55491de642ff

src/libraries/pkg/Microsoft.Windows.Compatibility/tests/Microsoft.Windows.Compatibility.Validation.csproj
src/libraries/pkg/Microsoft.Windows.Compatibility/tests/publishcompatibilityassets.ps1

index 8a7b6e5..05eae17 100644 (file)
@@ -5,6 +5,7 @@
     <NETCoreAppMaximumVersion>99.9</NETCoreAppMaximumVersion>
     <PackageConflictPreferredPackages Condition="'$(TargetFramework)' != 'netcoreapp2.0'">Microsoft.Private.CoreFx.NETCoreApp;runtime.$(RuntimeIdentifiers).Microsoft.Private.CoreFx.NETCoreApp;$(PackageConflictPreferredPackages)</PackageConflictPreferredPackages>
     <DisableImplicitFrameworkReferences Condition="$(TargetFramework.Contains('netcoreapp'))">true</DisableImplicitFrameworkReferences>
+    <NuGetTargetMoniker Condition="'$(NugetMonikerVersion)' != ''">.NETCoreApp,Version=v$(NugetMonikerVersion)</NuGetTargetMoniker>
   </PropertyGroup>
 
   <ItemGroup>
index 646b285..7feee4f 100644 (file)
@@ -1,5 +1,5 @@
 param (
-$targetFramework = "netcoreapp3.0",
+$frameworkVersion = "3.0",
 $runtimeVersion = "3.0.0-*",
 $refDirName = "netcoreapp30_compat",
 $rid = "win7-x64"
@@ -23,11 +23,14 @@ function _getPackageVersion($packageName)
        return $matches[0]
 }
 
-$repoRoot = ((get-item $PSScriptRoot).parent.parent.parent.FullName);
+$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
+
+$repoRoot = ((get-item $PSScriptRoot).parent.parent.parent.FullName)
 $dotnetPath = -join($repoRoot, "\Tools\dotnetcli\dotnet.exe")
 $csprojPath = -join($PSScriptRoot, "\", (Get-ChildItem $PSScriptRoot"\*.csproj" | Select-Object -ExpandProperty Name))
 $packagesCachePath = -join($repoRoot, "\packages")
 $localPackageSourcePath = -join($repoRoot, "\bin\packages\Debug\")
+$targetFramework = -join("netcoreapp", $frameworkVersion)
 
 if (!(Test-Path $localPackageSourcePath))
 {
@@ -47,11 +50,11 @@ $privatePackageVersion = _getPackageVersion "Microsoft.Private.CoreFx.NETCoreApp
 Write-Output "Calling dotnet restore"
 & $dotnetPath restore --packages $packagesCachePath /p:RestoreSources="$restoreSources" /p:TargetFramework=$targetFramework /p:CompatibilityPackageVersion=$compatPackageVersion /p:PrivateCorefxPackageVersion=$privatePackageVersion /p:RuntimeIdentifiers=$rid $csprojPath
 
-Write-Output "Calling dotnet publish"
-& $dotnetPath publish -r $rid /p:RestoreSources="$restoreSources" /p:TargetFramework=$targetFramework /p:CompatibilityPackageVersion=$compatPackageVersion /p:RuntimeFrameworkVersion=$runtimeFramework /p:PrivateCorefxPackageVersion=$privatePackageVersion /p:RuntimeIdentifiers=$rid $csprojPath
-
 $outputPath = -join($PSScriptRoot, "\bin\Debug\", $targetFramework, "\", $rid, "\publish\refs\")
 
+Write-Output "Calling dotnet publish"
+& $dotnetPath publish -r $rid -o $outputPath /p:NugetMonikerVersion=$frameworkVersion /p:RestoreSources="$restoreSources" /p:TargetFramework=$targetFramework /p:CompatibilityPackageVersion=$compatPackageVersion /p:RuntimeFrameworkVersion=$runtimeFramework /p:PrivateCorefxPackageVersion=$privatePackageVersion /p:RuntimeIdentifiers=$rid $csprojPath
+
 if (!(Test-Path $outputPath))
 {
        Write-Error -Message (-join("There was an error while publishing for framework: ", $targetFramework))
@@ -68,4 +71,5 @@ if (Test-Path $refPath)
 }
 
 New-Item $refPath -ItemType directory
-Copy-Item (-join($outputPath, "*")) $refPath
+Remove-Item (-join($outputPath, "Microsoft.Windows.Compatibility.Validation.dll")) -force
+Copy-Item (-join($outputPath, "*.dll")) $refPath