I've rebuilt my entity framework in an MVC 3 project. This was working before I did this. Now though, I get the error:
The type or namespace name 'myEntities' could not be found (are you missing a using directive or an assembly reference?)
everywhere in my code where it references the Entity Framework. This was working before the rebuild so it follows that it has to be that. I've checked that the name of the connection in my web.config and have deleted and re-installed the entity framework but it's not being referenced.
Any ideas how to fix this error?
Today I faced the same issue and waste my entire day.
Finally I start reading errors line by line and found the exact error.
On two tables I removed relationship and that was all the cause of problem.
Even I added all the relationship and update model but still not working.
Removed those tables from emdx on which I removed and re-added relationship
rebuild and found everything gone except the removed tables
Added those tables and done
Lo and behold, it was simple. I named the connection string to a different name than the object name I call in my code!
I solved this problem by deleting all tables from Entity .edmx then right click and select update model from database and select all tables you want ,Next rebuild the project.
Why don't you check out this other SO post which has a very similar problem to yours. It gives a few different suggestions to fix your problem and hopefully one of them will work out for you! Cheers!
The referenced component 'EntityFramework' could not be found.
Today I updated one table column. Had to delete and then re-add the table and any tables with a relationship to it to get it to generate properly again.
you can make another connection string...
or
try mentioning Using system.data.entity,
or
intall entity framework using manage Nuget Packages
or
select project name-> click tools(from menu items)-> package manager(nuget)->terminal
paste and run=> install-package EntityFramework
or
Find entity name in model browser as for example(green name in red circle)
Related
I'm in the process of migration a XamarinForms 5 app to MAUI and the latest error I get is
The Java type `mono.android.support.v4.media.session.MediaSessionCompat_OnActiveChangeListenerImplementor` is generated by more than one managed type
Searching online, so far I think it is because the app is using Android.Support.V4 when it should only be using AndroidX, causing the duplicate to be generated as AndroidX replaces Support.V4.
However I cannot figure out how to remove the Support.v4 package because the only reference to it is an implicit reference by an SDK which I cannot remove ( see screenshot below)
The project file (MAUI) only has these package references
Any help greatly appreciated.
Thanks
I'll answer my own question as I managed to figure out the issue after a solid several hours long session.
No packages needed to be removed. Somehow I had managed to install a version of
Birdie.Plugin.FirebasePushNotification from 2020 , instead of `Plugin.FirebasePushNotification', the current version.
The solution was to remove that old package and install the correct once which made the error go away.
I am trying to scaffold and getting following error:
There was an error running the selected code generator Method not found: 'Void EntityFrameworkCore.Design.Internal.DbContextOperations
https://learn.microsoft.com/en-us/ef/core/get-started/aspnetcore/existing-db?view=aspnetcore-2.0#install-entity-framework
I suspect you are missing the assemblies that are necessary for scaffolding? I also assume you are trying to reverse engineer an existing db?
example
Scaffold-DbContext "Server=(localdb)\mssqllocaldb;Database=Blogging;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
if it fails like i can't find it might be a pmc issue, try closing down VS try again. After that its probably a configuration with missing assemblies.
It may be the Microsoft.EntityFrameworkCore.Design version issue. Update it to version 2.0.3. It worked for me.
I got this error too when trying to add a new controller. The day before I had upgraded both Microsoft.EntityFrameworkCore.SqlServer and Microsoft.EntityFrameworkCore.Tools Nuget Packages from version 2.0.2 to 2.1.3.
Downgrading both packages to 2.0.2 allowed me to scaffold a new controller again.
Saeef's error is from trying to create CRUD razor pages, not creating the domain classes from an existing database
I had the same problem. I had two instances of VS2017 (enterprise & developer edition) for some reason I updated only one of them. The shourtcut on my desk was the 'out of date version' so I didnt figure it out until now.
I uninstalled the older, updated the other to 15.8+ and it works fine now.
MVC 3 web being built in VS2012 Update 1, connected to MySQL db.
I added an ado.net entity model as usual and all was fine until I realized the auto generated classes were not updating despite this bug supposedly being fixed in the VS Update 1. Anyway, I ended up deleting all the entity files (.context.tt, .designer.cs, .tt & the ed,x.diagram) I also deleted the ' connection string from the webconfig.
I then started over, added a new ado.net entity model, etc, but it keeps trying to add a 1 to the end of the name (same as the last one), so i assume there is still some reference to the old entity model in there somewhere.
Where are all the references,s o I can delete them? Is there a better way around this? I guess I could just choose a completely different name for the entity model, but that seems cheesey.
Oh and one other thing, I grabbed EF 5.0 with nuget, but in the project references, and all through the web config, it is referencing ef 4.4. Could this be part of the issue?
Normally, version 4.4 of EF will be referenced if you only have .NET 4 and not .NET 4.5.. check your project properties and see what version you are targeting
As for the connection string with a "1" on the end.. this may be a dumb question, but have you tried to find any references the old connection string by using "Find" and searching entire solution?
I recently installed the EF4.1-Update. When I made a new MVC3 Project and tried to add the MvcScaffolding using the PackageManagerConsole in VS2010 it wouldn't install it. Has anyone else
seen this? I removed the EF4.1-Update from my machine and MvcScaffolding installs correctly.
thanks,
Bill44077
You might have to clean out the packages folder in your solution and reinstall the MvcScaffolding. Once you do this everything should sync back up.
Good luck and hope this helps some.
It does work. And it works beautifully
But I had some issues getting it all setup.
What error(s) did you get exactly I had a number of issues, but solved them one by one.
Did you get this sort of thing in PMC when VS started up?
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(2943) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: Cannot convert the "Microsoft.PowerShell.Commands.SecurityDescriptorCommandsBase" value of type "System.String" to type "System.Type".
If so either update .net Refelector (now costs), or go Tools > Add-In Manager and disable the .NEt Reflector add in ! THEN RESTART VS
Or if you try to scaffold something, do you get e.g.
Invoke-Scaffolder : A parameter cannot be found that matches parameter name -ModelType"
?
Do you get errors when you try to add a controller to your MVC 3 project?
Are you running on Windows (pre 7) + without powershell 2.0 installed?
Basically don't worry it does work, I think the order or installations matters, just work through it bit by bit, its worth it.
Did you try reinstalling the update after the scaffolding is installed? I already had the scaffolding installed when I installed Update 1, so i did not see a problem.
I've had this problem before when the scaffolding.config file was either not present, or not filled with the Default Scaffolders -- make sure its populated with the default entries for views, controllers, etc. I think there is 9 by default in version 1.0.9.
Old post I know but this is still relevant in project templates and autogenerated projects -- the scaffolding.config needs to have its defaults.
I'm following the Microsoft guide for implementing federated identities. As it doesn't state where the code should be placed I created a file \App_Code\Auth.cs for it. when it's time to implement the FederationResult to my home controller I try to use the aforementioned namespace but VS complains of missing an assembly reference.
The weird thing is that the code in Auth.cs doesn't complain... I've looked in the References item of the project and don't see anything I can recognise, although I did "Add STS reference" to the project. I've also looked in NuGet but don't see anything I should add...
what's going on here?
hmm... seems I just needed to add the reference manually. I don't know how come the assembly is available to some pieces of the code and not to others but it works!
One more thing, I needed to use Microsoft.IdentityModel.Web not .Claims