abp icon indicating copy to clipboard operation
abp copied to clipboard

ConnectionString not found when DbMigrator is not CWD

Open Xeevis opened this issue 3 years ago • 1 comments

  • 6.0.0-rc.3
PS> abp new Acme.BookStore -d mongodb --create-solution-folder --preview
PS> cd Acme.BookStore
PS> dotnet run --project src\Acme.BookStore.DbMigrator
[23:23:05 INF] Started database migrations...
[23:23:05 INF] Migrating schema for host database...
Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'connectionString')
   at MongoDB.Driver.Core.Misc.Ensure.IsNotNull[T](T value, String paramName)
   at MongoDB.Driver.Core.Configuration.ConnectionString..ctor(String connectionString, Boolean isInternalRepresentation, IDnsResolver dnsResolver)
   at MongoDB.Driver.Core.Configuration.ConnectionString..ctor(String connectionString)
   at MongoDB.Driver.MongoUrlBuilder.Parse(String url)
   at MongoDB.Driver.MongoUrlBuilder..ctor(String url)
   at MongoDB.Driver.MongoUrl..ctor(String url)
   at Acme.BookStore.MongoDB.MongoDbBookStoreDbSchemaMigrator.MigrateAsync() in E:\Test\Acme.BookStore\src\Acme.BookStore.MongoDB\MongoDb\MongoDbBookStoreDbSchemaMigrator.cs:line 31

On the other hand this works fine

PS> abp new Acme.BookStore -d mongodb --create-solution-folder --preview
PS> cd Acme.BookStore/src/Acme.BookStore.DbMigrator
PS> dotnet run
[23:14:23 INF] Started database migrations...
[23:14:23 INF] Migrating schema for host database...
[23:14:24 INF] Executing host database seed...
[23:14:24 INF] Successfully completed host database migrations.
[23:14:25 INF] Successfully completed all database migrations.
[23:14:25 INF] You can safely end this process...

Xeevis avatar Sep 06 '22 21:09 Xeevis

The appsettings.json of the application is in the project directory.

I think dotnet run --project should switch to the project directory.

maliming avatar Sep 07 '22 00:09 maliming

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 12 '22 05:11 stale[bot]