pdevito3 / craftsman

A .NET scaffolding tool to help you stop worrying about boilerplate and focus on your business logic 🚀
https://wrapt.dev
MIT License
1.13k stars 66 forks source link

Trouble adding a new entity to an existing project #97

Open MetalHexx opened 2 years ago

MetalHexx commented 2 years ago

I am following your tutorial. All went well until I hit the step to add the ShoppingListEntity. It's saying it can't find the .sln file even though it's there. Nice project! Good conversation today! -wpereira

Steps to reproduce

Here is the output from the console:

$ craftsman add entity ShoppingListEntity.yaml Error: A solution file was not found in your current durectory. Please make sure you are in the solution directory for your project.

$ ls CarbonKitchen.sln README.md RecipeManagement SharedKernel ShoppingListEntity.yaml docker-compose.yaml

pdevito3 commented 2 years ago

Hey, thanks!

The add entity command should be run from the boundary folder (has your src and test directories), but it does check if you have a sln file in the parent directory, so that's probably what you're seeing. Mind trying that and letting me know?

pdevito3 commented 2 years ago

FYI, updating error messages to be better here

MetalHexx commented 2 years ago

The command worked this time when I ran it from the boundary folder and seems to have generated the expected files. The first time I ran it, it was from the same folder as the .sln file (see the "ls" console output above for the directories and files in the current folder). The boundary folder doesn't have the .sln file, so the new error message is still a bit misleading. Maybe some clarity in the tutorial will help.

However, I ran into another issue. It rendered the new feature classes with a typo in the using namespaces. For example, ShoppingListItemsController.cs was generated with a using statement declared as "using recipemanagement.Wrappers;" where it should be "using RecipeManagement.Wrappers;" Seems like a typo across most or all the files that were generated which created a bunch of errors.

But I figured out why that happened. When I entered the folder using "cd recipemanagement" Powershell brought me to a correct, but lowercased version of the correct directory "C:\dev\src\wrapt\carbonkitchen\recipemanagement". Weird! That's when the generator fails. It leads me to believe you're sourcing the namespace from the directory name at the time the command is run. So I blew away the entire solution and ran it again. I navigated to the boundary folder, but this time with the correct casing "cd RecipeManagement", and it generated everything properly. I did the whole thing one more time with a lower cased directory name and I was able to reproduce the problem. I reckon others might run into this. I can send you some screenshots later if you want.

Great tool though man, very impressive.

MetalHexx commented 2 years ago

here is the console output to show you what I mean by the strange lowercase directory issue:

PS C:\dev\src\wrapt\CarbonKitchen> cd .\RecipeManagement\ PS C:\dev\src\wrapt\CarbonKitchen\RecipeManagement> ls

Directory: C:\dev\src\wrapt\CarbonKitchen\RecipeManagement d----- 9/10/2022 12:32 PM src d----- 9/10/2022 12:32 PM tests

PS C:\dev\src\wrapt\CarbonKitchen\RecipeManagement> cd .. PS C:\dev\src\wrapt\CarbonKitchen> cd recipemanagement PS C:\dev\src\wrapt\CarbonKitchen\recipemanagement> ls

Directory: C:\dev\src\wrapt\CarbonKitchen\recipemanagement d----- 9/10/2022 12:32 PM src d----- 9/10/2022 12:32 PM tests

pdevito3 commented 2 years ago

Ooo, that is interesting. Never seen that one before, but your hunch sounds right.

Appreciate the insight and the kind words!!

MetalHexx commented 2 years ago

np -- good luck!