Last post Jul 26, 2018 10:06 AM by Yuki Tao
Jul 25, 2018 04:57 PM|SaeedP|LINK
I run this command on package manager console :
but keeping get this image:
The project first app demo failed to build.
What should I do?
Jul 25, 2018 05:27 PM|vahid bakkhi|LINK
It means that there have something wrong in your project, you need to check your project, rebuild it.
If we want to Enabling Migrations .The first step is to enable migrations for our context..
Code First Migrations has two primary commands that you are going to become familiar with.
Please refer to the links below for more details:
Jul 25, 2018 06:31 PM|SaeedP|LINK
Thanks for your reply.
I'm afraid my entity framework and sql configuration is correct in start up.cs.
Here comes my configuration:
public void ConfigureServices(IServiceCollection services)
var sqlconnection = "Data Source=(localdb)\\mssqllocaldb;Initial Catalog=FirstAppDemo";
services.AddDbContext<FirstAppDemoDbContext>(dbcontextoption => dbcontextoption.UseSqlServer(sqlconnection));
Would you please let me know if any thing is wrong?
Jul 25, 2018 06:39 PM|vahid bakkhi|LINK
It's not depended to your config
According to your error, I said first build your project and sure you do not get any error
If your project become build success
Next Add-Migration will scaffold the next migration based on changes you have made to your model since the last migration was created
Jul 25, 2018 06:45 PM|vahid bakkhi|LINK
Please refer to below link
Jul 25, 2018 07:35 PM|SaeedP|LINK
I built my project and there is no error.
In microsoft documentation comes to this command:
and when I write and run this command after a while this error comes which is highlighted:
Object reference not set to an instance of an object.
Jul 25, 2018 07:45 PM|vahid bakkhi|LINK
Please follow below link
Jul 26, 2018 10:06 AM|Yuki Tao|LINK
I can't reproduce your issue,
It looks like this might have been introduced by some of the changes made around connection managemenrt,you could refer to these links,
hope them could be helpful to you: