When I try to create a New Scaffolded Item
in my website project, I get the following message:
Error
There was an error running the selected code generator:
'There was an error getting the type '
SomeProjectInMySolution
.SomeModelInThatProject
'.Try rebuilding the project.'
Now, It seems that is not able to create it because is in a different context.
I tried doing what this answer suggested. But, failed.
What else could I try?
This is how I am filling the generation form:
Note:
I am using:
Entity Framework6 6.1.3
EntityFramework Reverse POCO Code First Generator:
to generate the context in that particular project where it exists.
All of my projects are buing built in 64-bit platform.
I also have the correct ConnectionString
in my Web.config
in the Website Project as well.
Thank you so much
Updates:
I also tried this. But, nothing.
I noticed that when trying to create the item, the console outputs this:
Attempting to install version '6.1.1' of 'EntityFramework' but the project already includes a different version. Skipping...
However, all my projects have 6.1.3
. Tried downgrading to 6.1.1
. But, still not working. Why is it even displaying that message?
<package id="EntityFramework" version="6.1.3" targetFramework="net451" />
DefaultAppPool Advanced Settings:
I finally found the solution for this horrible problem:
Several posts were sure that it was related to the x64
platform thing. So, in a last and desperate attempt I just changed the platform to Any CPU
(of every project), then I run the Scaffolded item generator, and then finally switched back 64-bit
.
I am not sure why this works. My coworker mentioned that Visual Studio was built in 32-bit and maybe that's what caused the issue. I really don't know. But, I hope this helps anyone in the future with the same problem.
Thanks to everyone who tried.
I had a similar problem with generating views from a controller in asp.net .
The problem here was, that my model class inherited from a class outside project, when i commented the inheritance out of the class, the generation worked and i was able to make the inheritance again.
like this:
public class Employee //: PersonBase {...}
so i generated and then i deleted the Comment slashes.
public class Employee : PersonBase {...}
Do not know if it helps you but it is worth a try.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With