Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PMC Tools: Throw a better exception when ActiveConfiguration returns null #22334

Merged
1 commit merged into from
Aug 31, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/EFCore.Tools/tools/EntityFrameworkCore.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1019,8 +1019,16 @@ function EF($project, $startupProject, $params, $applicationArgs, [switch] $skip
Write-Host 'Build succeeded.'
}

$activeConfiguration = $startupProject.ConfigurationManager.ActiveConfiguration
if ($activeConfiguration -eq $null)
{
throw "Unable to read project configuration settings of project '$($startupProject.ProjectName)' for the " +
'active solution configuration. Try closing Package Manager Console and restarting Visual Studio. If the ' +
'problem persists, use Help > Send Feedback > Report a Problem.'
}

$startupProjectDir = GetProperty $startupProject.Properties 'FullPath'
$outputPath = GetProperty $startupProject.ConfigurationManager.ActiveConfiguration.Properties 'OutputPath'
$outputPath = GetProperty $activeConfiguration.Properties 'OutputPath'
$targetDir = [IO.Path]::GetFullPath([IO.Path]::Combine($startupProjectDir, $outputPath))
$startupTargetFileName = GetProperty $startupProject.Properties 'OutputFileName'
$startupTargetPath = Join-Path $targetDir $startupTargetFileName
Expand Down