none
Sample runs with dotnet run, but not when running from VS IDE RRS feed

  • Question

  • Hi all...

    I stepped away from DB driven apps for many years, writing software in other disciplines and what not.  Coming back to all this and I'm trying to ramp up on the EntityFramework and .NET CORE.

    I'm following along with this tutorial. https://docs.microsoft.com/en-us/ef/core/get-started/?tabs=netcore-cli

    I'm wondering what I'm missing, but.  When I run this app at the command line with "dotnet run", the application seems to run fine.

    But when I try to launch it from VS IDE, I get an error saying "No such table Blogs" Or if I go out and just launch the exe directly, I get the same error.

    Do I need to configure VS to load something up when it runs?  My guess is that dotnet is somehow loading up some extra stuff at runtime. 

    Anyway, thank you all for any help!!!!


    Rick

    Thursday, March 5, 2020 9:30 PM

All replies

  • Hi m00n,
    Based on your description, I have some suggestions you can refer to.
    1.The main cause of the error is that the db file cannot be found. You can use an absolute path.
    2.Before you run it you must first create the database.
    3.As official document says that Visual Studio uses an inconsistent working directory when running .NET Core console apps.This results in an exception being thrown: no such table: Blogs.
    So you can set the working directory by following steps:
    3.1In Solution Explorer, right click the project and then select Properties.
    3.2Select the Debug tab in the left pane.
    3.3Set working directory to the project directory.
    3.4Save the changes.
    Here are some similar issues you can refer to.
    [ASP.NET 5, EF 7 and SQLite - SQLite Error 1: 'no such table: Blog']
    [What they forgot to tell you !!]
    Hope these are helpful for you.
    Best Regards,
    Daniel Zhang


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Friday, March 6, 2020 2:44 AM
  • Why can't you make a console Core project in Visual Stuido and install EF Core into the project using Nuget?

    https://docs.microsoft.com/en-us/visualstudio/get-started/csharp/tutorial-console?view=vs-2019

    https://www.entityframeworktutorial.net/efcore/install-entity-framework-core.aspx

    Friday, March 6, 2020 3:07 AM
  • Thanks guys... Sorry I haven't responded before now.  I will look into all your suggestions.  I really appreciate the feedback!



    Rick

    Tuesday, March 17, 2020 7:41 PM
  • Hi m00n,
    Has your problem been solved? If it is resolved, we suggest that you mark it as the answer. So it can help other people who have the same problem find a solution quickly.
    Best Regards,
    Daniel Zhang


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, March 19, 2020 5:58 AM