Skip to content

Commit

Permalink
Auto-detect that we need Core (#7560)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Forgind authored Apr 28, 2022
1 parent efc3ce9 commit 10dbde3
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions scripts/Deploy-MSBuild.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 10dbde3

Please sign in to comment.