I'm trying to update a database on a test system. When I run update-database
in visual studio things work as expected.
When I deploy and then try to run on a test machine:
Migrate.exe CodeFirst.dll /startupConfigurationFile="..\web.config"
I get:
no connection string named xxx could be found in the application config file
...even though there is a connection string with that name in the web.config. There is only one .config file, there isn't a config file for the dll that I'm running against
I attempted to declare my connection string manually:
Migrate.exe CodeFirst.dll /connectionString="Data Source=192.168...;Initial Catalog=Database;" /connectionProviderName="System.Data.SqlClient"
but that still gave the the same error for some reason... Is it ignoring the connection string that I'm passing in and trying to look for one again? Why would it do that?
but that gave me a really weird error:
The migrations configurations type "Source=192.168... could not be found in the assembly CodeFirst.dll I wondered if it had something to do with spaces, so I tried changing 'data source' to 'server' and Initial Catalog to 'database' but that didn't help.
edit: fixed quotation marks
I've seen similar questions but they were all about running inside of visual studio and I have no issues when trying to do that. Any more ideas of what I can do? Has anyone gotten either of these options to work?
Finally got this to work with Entity framework 6.1.3. I'm not sure if the version really matters, but we ended up downloading the code and debugging against that.
What really made the difference was using the full path in both of the paths required... Hope that can help someone!
I reached out to the EF team, and apparently things will be better in EF7: https://github.com/aspnet/EntityFramework/issues/2974
Those of us just starting to use this tool might find this PowerShell script useful - it contains some default values for some common use cases: