ErikEJ / EntityFramework6PowerTools

This is the codebase for Entity Framework 6 Power Tools Community Edition, and modern EF 6 providers for SQL Server and SQL Server Compact
Other
183 stars 27 forks source link

No connection string could be found in application config file when generating views #66

Closed DesertFoxAZ closed 4 years ago

DesertFoxAZ commented 4 years ago

Connection string not found

For some projects I cannot generate a view and get a dialog stating that "No connection string named 'XXXXXXX' could be found in the application config file.". The connection string does in fact exist in the app.config or web.config files and matches the name of the DbContext file.

I can get this to work for some other projects and am unable to determine what specifically about the projects where it does not work is different when comparing it to the ones that do work.

ErikEJ commented 4 years ago

Unless you share a repro project it is going to be very hard for me to help you.

DesertFoxAZ commented 4 years ago

DomainMonitoringApi.DataAccess..zip See attached. When I try creating the view at Models\DomainMonitoringApiContext.cs, I get the message shown above.

JohnDoe2193 commented 4 years ago

I am getting the same problem. May I ask why it needs to read connection string?

It seems all it should need is .CS file were database context is defined. In my case library project for which it tries to read App.config for doesn't even have App.config (it is a DLL library). So I just created a dummy App.config with empty connection string (correct string name but not server, database, user account) and it worked but I am not sure if the output was 100 correct.

DesertFoxAZ commented 4 years ago

I had my co-worker try it and he was able to get it to work. However, on my machine, it works sometimes and not others. I had created the views on one database before my original post but now I can't do it anymore. The other database that didn't work from the beginning still doesn't work.

ErikEJ commented 4 years ago

@desertfoxAZ Sound like it going to be very hard for me to repro - in addition, I cannot build your project

ErikEJ commented 4 years ago

Closing as unable to repro