From 10dbde3bf1986251a5e958af8c7391ad0d9e7f11 Mon Sep 17 00:00:00 2001 From: Forgind Date: Thu, 28 Apr 2022 12:49:22 -0700 Subject: [PATCH] Auto-detect that we need Core (#7560) With Deploy-MSBuild.ps1 Only works if you're deploying to a folder that looks like *dotnet*sdk* Note that this is a bit hacky, but I think that's fine for a script that is mostly used by us. Testing I tried deploying to a folder that looked like ...\dotnet\sdk\folder, and it put the Core assemblies in rather than Framework as desired. --- scripts/Deploy-MSBuild.ps1 | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/scripts/Deploy-MSBuild.ps1 b/scripts/Deploy-MSBuild.ps1 index 6bb58a189b1..26100d3ab06 100644 --- a/scripts/Deploy-MSBuild.ps1 +++ b/scripts/Deploy-MSBuild.ps1 @@ -4,8 +4,8 @@ Param( [string] $destination, [ValidateSet('Debug','Release')] [string] $configuration = "Debug", - [ValidateSet('Core','Desktop')] - [string] $runtime = "Desktop" + [ValidateSet('Core','Desktop', 'Detect', 'Full')] + [string] $runtime = "Detect" ) Set-StrictMode -Version "Latest" @@ -50,6 +50,20 @@ $BackupFolder = New-Item (Join-Path $destination -ChildPath "Backup-$(Get-Date - Write-Verbose "Copying $configuration MSBuild to $destination" Write-Host "Existing MSBuild assemblies backed up to $BackupFolder" +if ($runtime -eq "Detect") { + if ($destination -like "*dotnet*sdk*") { + $runtime = "Core" + Write-Host "Detected path that looks like an sdk. Writing .NET Core assemblies." + } + else { + $runtime = "Desktop" + Write-Host "Detected path that does not look like an sdk. Writing .NET Framework assemblies." + } +} +else if ($runtime -eq "Full") { + $runtime = "Desktop" +} + if ($runtime -eq "Desktop") { $targetFramework = "net472" } else {