Hi,
After creating a new project I tried adding the Blogging and Docs modules using abp add-module Volo.Blogging
and abp add-module Volo.Docs
Both ends with an error
No DbContext was found in assembly 'Project.DbMigrator'. Ensure that you're using the correct assembly and that the type is neither abstract nor generic.
When I run DbMigrator, data tables related to both the modules are not created.
Is there anything I can do to manually create these tables?
I am using Visual Studio for Mac
Thanks.
6 Answer(s)
-
0
I tried copying appsettings.json to EntityFrameworkCore.DbMigrations project and manually run
dotnet ef migrations add Blogging
after which the DbMigrator succeeded but the Web Project Exits now.
Is this the correct way to handle the issue?
-
0
I could finally get it working but when I try to create a blog post it again throws up error saying
"The Cover Image field is required."
I did select a image file but it still complains.
I was expecting this to work right out of the box. Will try to solve that but if you have a proper way please let me know
-
0
Hi,
I encountered none of the problems in your first 2 posts. My steps were:
- Download a pro template.
- Run .DbMigrator project.
- Run
abp add-module Volo.Blogging
. - Run the application.
- Create a new blog.
All works well.
"The Cover Image field is required."
You encountered that probably because of a missing document/explanation or missing a step in add-module command.. Sorry for that. You must set the configuration below.
using Volo.Blogging.Files; Configure<BlogFileOptions>(options => { options.FileUploadLocalFolder = Path.Combine(hostingEnvironment.WebRootPath, "files"); });
-
0
I tried the above steps again with a new project and I still have that issue, I used abp suite to create the new project
After adding BlogFileOptions the create blog post is working fine and overall blog module is working with the project where I manually run migration.
here is the terminal log
abp add-module Volo.Blogging [03:09:49 INF] ABP CLI (https://abp.io) [03:09:49 INF] Version 2.0.1 (Stable channel) [03:09:51 INF] Installing module 'Volo.Blogging' to the solution 'TestProject' [03:09:51 INF] Installing 'Volo.Blogging.Application' package to the project 'TestProject.Application'... Writing /var/folders/qp/2d9crq9d2_g968n28tz89jmc0000gn/T/tmp6ffiVW.tmp info : Adding PackageReference for package 'Volo.Blogging.Application' into project '/Users/krishna/Project/TestProject/src/TestProject.Application/TestProject.Application.csproj'. .... ..... info : Committing restore... info : Generating MSBuild file /Users/krishna/Project/TestProject/src/TestProject.Web/obj/TestProject.Web.csproj.nuget.g.props. info : Writing assets file to disk. Path: /Users/krishna/Project/TestProject/src/TestProject.Web/obj/project.assets.json log : Restore completed in 2.11 min for /Users/krishna/Project/TestProject/src/TestProject.Web/TestProject.Web.csproj. [03:16:37 INF] Successfully installed. [03:16:37 INF] Checking installed npm global packages... [03:17:22 INF] Installing yarn... npm ERR! code EEXIST npm ERR! syscall symlink npm ERR! path ../lib/node_modules/yarn/bin/yarn.js npm ERR! dest /usr/local/bin/yarn npm ERR! errno -17 npm ERR! EEXIST: file already exists, symlink '../lib/node_modules/yarn/bin/yarn.js' -> '/usr/local/bin/yarn' npm ERR! File exists: /usr/local/bin/yarn npm ERR! Remove the existing file and try again, or run npm npm ERR! with --force to overwrite files recklessly. npm ERR! A complete log of this run can be found in: npm ERR! /Users/krishna/.npm/_logs/2020-02-10T08_17_27_555Z-debug.log [03:17:28 INF] Installing '@abp/blogging' package to the project '/Users/krishna/Project/TestProject/src/TestProject.Web/package.json'... [03:17:28 INF] yarn add @abp/blogging yarn add v1.19.2 warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json. [1/4] 🔍 Resolving packages... ..... .... ├─ tui-editor@1.4.10 └─ uc.micro@1.0.6 ✨ Done in 185.56s. [03:20:35 INF] gulp [03:20:43] Using gulpfile ~/Project/TestProject/src/TestProject.Web/gulpfile.js [03:20:43] Starting 'default'... [03:20:57] Finished 'default' after 14 s Build started... Build succeeded. No DbContext was found in assembly 'TestProject.DbMigrator'. Ensure that you're using the correct assembly and that the type is neither abstract nor generic. Build started... Build succeeded. No DbContext was found in assembly 'TestProject.DbMigrator'. Ensure that you're using the correct assembly and that the type is neither abstract nor generic.
-
0
Well, i figured it out.
See https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/EfCoreMigrationAdder.cs#L15
In Mac/Linux environment ,
dotnet ef
command is run on dbMigrator project. That is the problem. We'll fix this in next release (v2.1.0). -
0
I've created an issue: https://github.com/abpframework/abp/issues/2795