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

Throw error for unsupported scenarios in dotnet-ef #5312

Merged
merged 2 commits into from
May 10, 2016

Conversation

natemcmaster
Copy link
Contributor

@natemcmaster natemcmaster commented May 9, 2016

Point users to a webpage with dotnet-ef RC2 limitations when:

  1. When dotnet-ef fails on a class library project or
  2. Loading external startup on desktop .NET

Fix #5321

@natemcmaster
Copy link
Contributor Author

cc @divega

@divega
Copy link
Contributor

divega commented May 9, 2016

LGTM. I think @rowanmiller should review the message and provide the forward link.

@natemcmaster
Copy link
Contributor Author

@divega I've updated this PR to include the removal of "--startup-project". 😢

if (IsDotNetProject $fallbackProject) {
# this means users specified -StartupProject explicitly
# otherwise, ignore what VS has marked as the "startup project"
Write-Warning "'-StartupProject' is not supported on .NET Core projects. This parameter will be ignored."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it not supported in .NET Core projects or in project.json based projects?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. It's all "xproj" type projects.

@divega
Copy link
Contributor

divega commented May 10, 2016

I had a question about an error message in the PowerShell commands but everything else LGTM.

@natemcmaster
Copy link
Contributor Author

Also added a fix for #4832 because this is going to be encountered much more now.

{
// TODO
var fwlink = "";
Reporter.Error.WriteLine($"This version of Entity Framework tools for .NET Core CLI does not support class library projects. See {fwlink} for more details.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

http://go.microsoft.com/fwlink/?LinkId=798221

Here is my suggestion for the message...

This preview of Entity Framework tools does not support targeting class library projects in ASP.NET Core and .NET Core applications. See {fwlink} for details and workarounds.

@natemcmaster natemcmaster force-pushed the namc/not-supported-errors branch from 96222db to 33e3c84 Compare May 10, 2016 17:50
@natemcmaster
Copy link
Contributor Author

Updated with PR feedback.

@@ -237,4 +237,7 @@ Change your target project to the migrations project by using the Package Manage
<data name="ForceRemoveMigration" xml:space="preserve">
<value>Removing migration '{name}' without checking the database. If this migration has been applied to the database, you will need to manually reverse the changes it made.</value>
</data>
<data name="NoParameterlessConstructor" xml:space="preserve">
<value>No parameterless constructor on type '{contextType}' was available. Either add one to '{contextType}' or add an implementation of 'IDbContextFactory&lt;{contextType}&gt;'.</value>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rowanmiller new exception message if I am not mistaken.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor changes....

No parameterless constructor was found on '{contextType}'. Either add a parameterless constructor to '{contextType}' or add an implementation of 'IDbContextFactory<{contextType}>' in the same assembly as '{contextType}'.

@divega
Copy link
Contributor

divega commented May 10, 2016

:shipit: with any necessary changes to exceptions.

Nate McMaster added 2 commits May 10, 2016 12:28
…rs when dotnet-ef fails on a class library project

Add warning in powershell that -StartupProject is going to be ignored
@rowanmiller
Copy link
Contributor

:shipit: with exception message updates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants