Always missing 'System.Data.Entity.Design' - c#

Recently while working on a webp project within Visual Studio 2013, I updated a website that was using Entity Framework Database First, and wanted/needed to update to EF 6. Upon doing so I also needed to update the EF EDMX designer in order to support EF 6. The upgrade went perfectly fine within the web app I was working on.
I later opened a previous web project, one which does not make any use of EF, and was greeted with the application error message "Could not load file or assembly 'System.Data.Entity.Design'." I thought it was odd, that I was getting this error in a project that has 0 references or utilization of EF in anyway. Thinking it was something weird in VS I closed it and attempted to reopen the project and run it, but again the same error. So I then added System.Data.Entity.Design to the references list and I STILL couldn't run it, so I changed the properties to "Copy Local: True" and it finally worked.
I have been encountering this issue in all web projects I open and create, unless I already fixed the issue with the Copy local change. I figured that something with the update must not have occurred correctly and therefore not installed the EF DLLs to the GAC so I tried using gacutil to make the install using the command gacutil.exe /i System.Data.Entity.Design.dll but was presented with error message below.
Does anyone have any suggestions on how to resolve this issue? While it's not project breaking, it is rather frustrating whenever opening or creating projects to add an unnecessary DLL to the project simply to get it to run and debug.

Related

EF Core removes EF dependencies during migration

I've been trying to set up EFCore with .NET6. When all my Models/Entities are inside a folder, the Initial Migration I ran removes all the dependencies(some) from the project and results in a failed build. But when I initially store my model in the root directory and run the same command it works.
This is the folder structure which causes the issue
Update
The last time I tried migrations worked if I placed the models and entities at the project's root, but now, even if I do, the same error happens. Please help me with this error. Thanks in advance.
Apparently, Visual Studio did not save the changes to the .csproj file on disk when I installed all the NuGet packages which resulted in the build failed error. This issue will not happen when we use visual studio to build the project because it will persist the changes to the disk when we do that but I used the CLI to build and run the migrations which resulted in this error.

Predefined type 'System.String' is not defined or imported

I have an MVC5 application which I'm trying to run offline. I installed VS2017 offline but when I try to build the project it throws multiple errors relating to it missing all the .NET assemblies and dlls. When I try to add these assemblies they're not available to be added. Anyone please help.
PS: there's NO internet on the machine.
I also have that problem from time to time. What usually helps is to do a dotnet restore. This is different to running restore from the solution explorer within VS, you have to do it through the command line. In order to execute it, you need to have the .NET Core SDK installed. dotnet restore is usually very good at fixing some project problems such as corrupted .json files that VS creates behind the scenes and I would guess that it is able to repair those files without internet connection, but I haven't tried.
Try cleaning and rebuilding your solution. I had this issue and something went funky with my dll's.
It's obvious omnisharp error same as mine. I changed omnisharp path version from c# extension(c# > unistall > install another version) and reopened to vscode. It worked for my project. All error has gone.

File or assembly Microsoft.SqlServer.SqlClrprovider missing in Entity Framework

I moved my Entity Data Model from one project to onother project. By cutting the data model folder and pasting in different project. Everything went fine, but when I try to update the 'Model from Database' I get the error of missing assembly Microsoft.SqlServer.SqlClrprovider after providing it the SQL connection. I tried addding some references but it did not helped. I am presently unable fix this problem. Below is the screenshot of error.
The problem got fixed by installing the following MSIs.
SQLSysClrTypes.msi
and
SharedManagementObjects.msi
These can be found here https://www.microsoft.com/en-us/download/details.aspx?id=42295
Choose the MSI according to machine architecture x64 or x86. Do not forget to restart Visual Studio. Try rebooting machine if that not works.

There was an error running the selected code generator: 'Object reference not set to an instance of an object.' Error?

I have tried all the solution like repairing the VS 2013 but no use.
when you create a controller by right clicking on the Controller folder and you add the controller, then you right click in the Action of the newly created controller and select Add View, it happens right then, when I try to create a view. Its not a new project, its an existing project.
For me the error had to do with the fact that I had a project in my solution that was a .NET Core project library and was referenced in the project that housed the DbContext.
Removing - or I guess changing the type - the .NET core library resolved the issue
I had this issue on my VS2017 and i solved it by doing this:
Go to C:\Users\username\AppData\Local\Microsoft\VisualStudio\15.0_7fca0c70 and you will see a folder named ComponentModelCache just renamed it like _ComponentModelCache or anything else,visual studio will create this folder again.
One thing to notice under VisualStudio folder name 15.0_7fca0c70 can be differenct it depends on your VS version. Now you are good to Go. Hope it helps somebody.
Deleting the .vs folder inside the solution directory worked for me.
Visual Studio 2019/2022:
Clean Project
Rebuild Project
Close and reopen Visual Studio 2022
If not works -> update Microsoft.VisualStudio.Web.CodeGeneration.Design NuGet package to latest and try again.
I have the same error in Visual Studio 2017 I fix it by this solution :
1 - if you use any database , must be install all drivers (I mean Nugget packages and etc...)
(I use MySql db so i must I first install MySql installer and install MySql,Data,EntityFramWorkCore)
2 - I Update My Visual Studio with Visual Studio Installer (your must be search visual studio installer in start and run it next update (don't need to add any new component or codes only select Update Button ) )
It work for me , I hope this will be help you
Tried all the following answers with no luck:
Solution Clean
Deleting old migrations
Close and reopen Visual Studio
Delete Visual Studio temp Components folder
This one worked:
Uninstalled the package (Microsoft.VisualStudio.Web.CodeGeneration.Design) and re-installed it from Package Manager Console.
My environment:
Visual Studio 2019 -
Razor Pages - .Net Code 2.2 - Windows 10
My issue (which specifically has the 'Object reference not set to an instance of an object.' error) was resolved by changing some of the projects in the Solution from .net standard 2.0 to .Net Framework 4.8.
This was inspired by the answer by Timo Hermans above and having tried the main answer deleting the ComponentModelCache which had helped previously.
In the project I was performing the scaffolding in I traced projects that linked to the Model I was using and changed them to net48. I did not have to change them all, so not entirely sure which projects but I started with the Models project and then followed other key projects changing them back to net48 until the scaffolding worked again.
Hope this might be of use to someone because it was driving me made!
Simple steps that worked for me like charm
Remove the project from the solution
Use Add Exisiting project to add the same project back
Build and Add View now, it works
This Error is related to Entity Framework Data Model ..
for solution Perform these Steps...
Delete your Entity Framework Data Model.
Again Regenerate the Model from Database Design.
then Rebuild the Solution ... and Enjoy Coding .
Try installing the Windows Management Framework:
https://www.microsoft.com/en-us/download/details.aspx?id=34595
Restart the PC after installing.
I have the same error, I just removed only read permission in the folder where is the web project
Or maybe like me you didn't notice the 'Data context class' field was blank. Oops. If so, simply select your data context class and try again.
There really should be a better error for this scenario.
Removed the error by starting a whole new project because I had initially referenced a Class Library that housed the data access and business logic code for my project.
I have the same error in vs2017 on windows10, pls try to run vs as admin, hope it'll work for you too.
Although I had not noticed right away that my ability to add Controllers ceased when I added another project to the solution, I eventually caught on that this was a repeatable cause for my disruption. This is what worked for me:
In addition to the .Net Web App project where I was adding Controllers, I had added another project to the solution- this causes the problem for me.
I unloaded the new project and then tried the Add Controller step again. This time it worked.
I then reloaded the new project and continued to work
It took me a couple of hours to diagnose and solve this. Maybe it helps someone else to not spin wheels this long!
Instead of renaming, I left DefaultController then renamed it after it was created.
I had a Standard .Net v2 class library beside my main ASP.Net MVC project which targeted .Net Framework v4.6.2 and after several controller creation suddenly the mentioned error came up.
So I :
Removed references to the class library
Deleted class library entirely
Created another one with .Net Framework v4.6.2
and the problem solved.
I had the same error, I just closed the web.config file and its working now.
Same error in VS2019, looks like I'd missed a project reference after collapsing three projects into a single solution.
I'd referenced the API and class library in my UI project so I could use the db context (in the API project) and class files for scaffolding, but failed to reference the class library in the API project (it'd previously been added as a NuGet package) and it gave me this error message.
Uninstalled the package and added as a project reference and my issue seems to be fixed.
I just removed the space** from DATA CONTEXT CLASS. worked for me.
Add View > Data Context Class >
REGMVCEntities**(REGISTRATION.Models)
For me I downgrade My packages from 5.0.5 to 5.0.4 all thinks work fine
In the end, my problem was that the project to which I was trying to add a scaffolded item was on a network shared drive / mapped drive. Moving the project to a local disk fixed my problem.
VS 2013 Update 5
Rebuild your project and check the warning messages. Try to fix those and try again!
Just change your ConnectionString in Web.Config file From
<add name="xxx" connectionString="Data Source=xxx;initial catalog=xxx;Persist Security Info=True;User ID=xxxx;Password=xxxx;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
To
<add name="xxx" connectionString="metadata=res://*/EFMOdel.csdl|res://*/EFMOdel.ssdl|res://*/EFMOdel.msl;provider=System.Data.SqlClient;provider connection string="data source=xxxx;initial catalog=xxxx;persist security info=True;user id=xxxx;password=xxx;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />

The operation could not completed

I have created new MVC web application in visual studio with Individual account. Every functionality is working fine including Identity and sql localDB.
But when I add entity framework into my project. It giving me error in dialog box. "The operation could not completed". In output window i saw
TF10121: The path '\\D:\c#\2016\testdelete\testdelete\Data\Model1.edmx.diagram' is not found or not supported. Type or select a different path.
I googled it but everybody giving different solution and those are not working.
I re-install my visual studio, but same error.
Do I need to change any path to solve this issue ?
I have created new solution from scratch, and there is only one project.
Tried with below solutions,
VS2010 The operation could not be completed
Installed mentioned package. (ASPNET WEB FRAMEWORK TOOL)
Visual studio was suggested me to install "AspNet5.ENU.RC1_Update1_KB3137909", and I installed this too.
I am using latest EF.
I tried to remove project and created new project as mentioned here,
http://chrisghardwick.blogspot.in/2011/12/tf10121-path-is-not-found-or-not.html

Categories

Resources