Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
8 changes: 8 additions & 0 deletions src/dotnet-ef/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/dotnet-ef/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,9 @@
<data name="PrecompileQueriesWarning" xml:space="preserve">
<value>Query precompilation is an experimental feature and should be used with caution.</value>
</data>
<data name="PlatformSpecificProject" xml:space="preserve">
<value>Startup project '{startupProject}' targets a platform-specific framework: '{targetFrameworkValue}'. The Entity Framework Core .NET Command-line Tools might not function correctly. Implement IDesignTimeDbContextFactory&lt;&gt; to ensure design-time tools work correctly with this project. See https://aka.ms/efcore-docs-migrations-projects for more information.</value>
Comment thread
AndriySvyryd marked this conversation as resolved.
</data>
<data name="PrefixDescription" xml:space="preserve">
<value>Prefix output with level.</value>
</data>
Expand Down
23 changes: 23 additions & 0 deletions src/dotnet-ef/RootCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ protected override int Execute(string[] _)
startupProject.AssemblyName + ".runtimeconfig.json");
var projectAssetsFile = startupProject.ProjectAssetsFile;

if (!string.IsNullOrEmpty(startupProject.TargetPlatformIdentifier))
Comment thread
AndriySvyryd marked this conversation as resolved.
Outdated
{
Reporter.WriteWarning(
Resources.PlatformSpecificProject(startupProject.ProjectName, startupProject.TargetPlatformIdentifier));
}
else if (HasPlatformInTargetFramework(startupProject.TargetFramework))
{
Reporter.WriteWarning(
Resources.PlatformSpecificProject(startupProject.ProjectName, startupProject.TargetFramework));
}
Comment thread
AndriySvyryd marked this conversation as resolved.
Outdated

var targetFramework = new FrameworkName(startupProject.TargetFrameworkMoniker!);
if (targetFramework.Identifier == ".NETFramework")
{
Expand Down Expand Up @@ -313,6 +324,18 @@ private static string GetVersion()
=> typeof(RootCommand).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()!
.InformationalVersion;

private static bool HasPlatformInTargetFramework(string? targetFramework)
{
if (string.IsNullOrEmpty(targetFramework))
{
return false;
}

// Check for netX.Y-Z form (e.g. net8.0-windows10.0.19041.0)
Comment thread
AndriySvyryd marked this conversation as resolved.
var dashIndex = targetFramework.IndexOf('-');
return dashIndex > 0 && dashIndex < targetFramework.Length - 1;
}

private static bool ShouldHelp(IReadOnlyList<string> commands, IList<string> args)
=> args.Count == 0
|| commands.Count == 0
Expand Down