Skip to content

Commit

Permalink
Migrations Bundles: Fix some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
bricelam committed Aug 17, 2021
1 parent 91a398b commit f102f1d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/EFCore.Tools/tools/EntityFrameworkCore.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ function Bundle-Migration

if (!$Framework)
{
$Framework = GetProperty $startupProject.Properties 'FriendlyTargetFramework'
$Framework = GetProperty $dteStartupProject.Properties 'FriendlyTargetFramework'
}

$params = 'migrations', 'bundle', '--framework', $Framework
Expand Down
33 changes: 11 additions & 22 deletions src/ef/Commands/MigrationsBundleCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Tools.Generators;
using Microsoft.EntityFrameworkCore.Tools.Properties;
Expand Down Expand Up @@ -85,27 +84,17 @@ protected override int Execute(string[] args)
{
var publishArgs = new List<string> { "publish" };

string? exe;
if (_runtime!.HasValue())
{
var runtime = _runtime!.Value()!;
publishArgs.Add("--runtime");
publishArgs.Add(runtime);

var baseLength = runtime.IndexOfAny(new[] { '-', '.', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' });
var baseRID = runtime.Substring(0, baseLength);
exe = string.Equals(baseRID, "win", StringComparison.OrdinalIgnoreCase)
? ".exe"
: null;
}
else
{
publishArgs.Add("--use-current-runtime");

exe = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
? ".exe"
: null;
}
var runtime = _runtime!.HasValue()
? _runtime!.Value()!
: (string)AppContext.GetData("RUNTIME_IDENTIFIER");
publishArgs.Add("--runtime");
publishArgs.Add(runtime);

var baseLength = runtime.IndexOfAny(new[] { '-', '.', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' });
var baseRID = runtime.Substring(0, baseLength);
var exe = string.Equals(baseRID, "win", StringComparison.OrdinalIgnoreCase)
? ".exe"
: null;

var outputPath = _output!.HasValue()
? _output!.Value()!
Expand Down

0 comments on commit f102f1d

Please sign in to comment.