When using project.EntityFramework do the database migration, it not succeed. Rum from cmd line, using 'dotnet ef database update', got below message: "Could not find content root folder!"
What happened? No exception was thrown.
13 Answer(s)
-
0
Hi,
cmd location must be in the root of *.EntityFramework project. Did you tried in that way ? If so, can you send a screenshot of your command line.
Thanks.
-
0
Yes, via "cd" command changed to root direction of the *.EntityFramework,then run "dotnet ef database update", I will share you a screenshot tomorrow
-
0
Thanks, waiting for the screenshot. I couldn't offer you a solution right now.
-
0
-
0
This is really funny. I got same error (After change my Solution name)
Check the logic in <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate-samples/blob/master/SimpleTaskSystem-Core/src/Acme.SimpleTaskApp.Core/Web/WebContentFolderHelper.cs">https://github.com/aspnetboilerplate/as ... rHelper.cs</a>
Seems like its looking for fixed solution name, and assume it as the Root folder.
Change it to old Solution name fix this issue.
-
0
Yes, just like you said, a strange problem. I changed the name of the solution to the old one, it works fine.
-
0
Hi,
Actually changing solution name after project creatin is not suggested but I understand there might be such a need after some time of development.
We didn't share our project renaming code because of licensing issues, see <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/issues/200">https://github.com/aspnetzero/aspnet-zero/issues/200</a>.
In your case I think you need to change project names in WebContentDirectoryFinder.cs. But if you even solve this problem, there might be some other issues.
-
0
<cite>ismcagdas: </cite> Hi,
Actually changing solution name after project creatin is not suggested but I understand there might be such a need after some time of development.
We didn't share our project renaming code because of licensing issues, see <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/issues/200">https://github.com/aspnetzero/aspnet-zero/issues/200</a>.
In your case I think you need to change project names in WebContentDirectoryFinder.cs. But if you even solve this problem, there might be some other issues.
Where I can find WebContentDirectoryFinder.cs file?
-
0
-
0
while (!DirectoryContains(directoryInfo.FullName, "MySolution.sln")) { if (directoryInfo.Parent == null) { throw new Exception("Could not find content root folder!"); } directoryInfo = directoryInfo.Parent; }
This code should not search for solution name (MySolution.sln) -- this is a auto generated code.
I have the same issue when deploying to azure (when there is no solution file)
-
0
it's used only in development environment to work with package manager console window. when you publish it shouldn't be executed
-
0
I just finished the upgrade from 4.6.1 to 5.0.2 - and encountered the same exception on database-update. Since it was mentioned that this exception occurs because of solution's name (e.g. when it has been renamed) I had a closer look at the solution file. After the upgrade there were two solution files in my project Folder, the old one named Company.ProjectName and the new one named Company.ProjectName.All. So I tried to simply copy the content of the newer solution file into the old solution file, renaming every occurence of Company.ProjectName.All to Company.ProjectName and use this solution file instead of the new one. Still, the exception was thrown. Then I recognized, that WebContentDirectoryFolder.CalculateContentRootFolder() was looking for a solution file named Company.ProjectName.Web.sln - but that didn't exist anywere in my project folder. So I changed that string to look for Company.ProjectName.sln and the exception did not occur anymore. Strangely though, the naked update-project does not have any Problems with Company.ProjectName.Web.sln, only after I merged it with my development-branch the problem occured - so this made me wonder even more. I had a look into the update-project folder and there it was: the Company.ProjectName.Web.sln solution file! I copied the file to my development-branch folder, and nowWebContentDirectoryFolder.CalculateContentRootFolder() can find Company.ProjectName.Web.sln without problems. Long story short: Version Control had no idea of the missing solution file. All's well that ends well.
-
0
Thanks @alexanderpilhar :).