reset password
Author Message
duck10438
Posts: 36
Posted 15:03 Jul 15, 2020 |

I need to use dotnet run to run my application. When I run it with visual studios I get this error

 

"System.TypeInitializationException: The type initializer for 'hw1.AppDbContext' threw an exception.
 ---> System.IO.FileNotFoundException: The configuration file 'appsettings.json' was not found and is not optional. The physical path is 'C:\Users\Johnny Lee\Documents\summer2020\hw1\bin\Debug\netcoreapp3.1\appsettings.json'."; 

Is there something I can change for my visual studios?

 

Amirebm
Posts: 8
Posted 15:09 Jul 15, 2020 |

Have you installed json dependecy? If yes, you should create a json file called "appsettings.json".

Kasthuri
Posts: 3
Posted 15:12 Jul 15, 2020 |

Hi, I also got same issue earlier

Try to change appsetting.json file property  (Copy to output directory value as copy always ) and check. (Refer attached image)

It's worked for me,