Entity Data Model Wizard crashes on Specify connection string dialog - entity-framework

Whenever I try to add an entity data model in Visual Studio 2013 on Windows 8.1 I see the following.
Does anybody have an idea how to fix this? I see the dialog to specify a database connection appear for a split second then dissapears.

I found a solution. Go into view->Server Explorer and remove any "Data Connections". Then this worked again.

I solved it by doing the following.
Make sure the versions of MySql.Data, MySql.Data.Entities, MySql.Web dll files in C:\Program Files (x86)\MySQL\MySQL Connector Net x.x.x\Assemblies\v4.5 and C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies are the same.
Make sure your project references the same version of dll
In my case my
MySql connector was 6.9.6
C:\Program Files (x86)\MySQL\MySQL Connector Net x.x.x\Assemblies\v4.5 and C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies had it as 6.8.3
Project referenced 6.8.3.
After updating all versions with same dlls, now I am able to update the "Model from database"
Hope this helps someone
Edit: A few weeks after there was some windows update which again screwed up the settings. To resolve it, I had to re-run the My Sql Connector installation and My Sql for Visual Studio, it worked fine after that.

Delete all connections in the Database Explorer Window and in the ADO .Net wizard add a new connection. I was able to solve this problem this way.

you have to delete all other connection from server explorer and delete other connection ss web.config

I Had a similar problem, spent 2 days trying many solutions but I finally solved. I just had to :
- Install MySQL For Visual Studio 2.0.5
- uninstall and install MySQL Connector 6.9.9
Note: Please follow the order VS => Connector and respect the version.
Finally I faced other problem and solved by adding an empty emdx first then changing SSL Generate Template property from SSDLToSQL To SSDLTOMySQL

Install MySql for VS 1.2.9
Install MySql Connector 6.8.3
Add these Nuget Packages to your Project:
EntityFramework // 6.4
Mysql.Data // 6.8.8
Mysql.Data.Entities // 6.8.3
Mysql.Web // 6.8.8
In the Solution Explorer, edit App.config(Add or Replace):
<entityFramework>
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
</providers>
</entityFramework>
rebuild and nothing more

For Anyone having this issue in VS 2019. This is what I did after a week long troubleshooting and googling, I just remove:
EntityFramework
MySql.Data.Framework or MySql.Data (or any other MySQL Nugget Packages you have added)
Then I re-install just this two in same order:
EntityFramework
MySQL.Data.EntityFramework
Then Update you entityframework section in app.config/web.config as follows:
I did not add default connection factory, I also remove version info from MySQL

Related

Connecting DevExpress XtraReports with PostgreSQL in Visual Studio

I have DevExpress XtraReports v18.1.6 version and PostgreSQL 4 v3.3. Visual studio 2017 v15.3.3 and Windows 7.
Here is scenario: In my project, I have some reports writen in devexpress v17.2. I could not run those reports, because I could not download exactly that version 17.2, I install new 18.1.6. Then in Visual studio main menu "DevExpress" I click on "Project converter to 18.1.." and that action replace my old dlls v17.2 with new 18.1. After that I could run reports (see it in designer).
But problem is with databse connection. I created connection string with "XpoProvider=Postgres".
Every time when I want to get data in report, or rebuild result shema, or manage queries I get error:
Could not load file or assembly 'System.Threading.Tasks.Extensions, Version=4.2.0.0,...
I have that reference, exactly that version. Also I tried with new versions of threading.tasks but unsuccessfully.
My version of Npgsql.dll was 2.2.7, I tried with 3.2.5 (read from some devexpres documentations). Also tried with new 4.0.3.
Did anyone have a similar problem?
we had the same issue when using the DevExpress (18.1) Report Designer with Visual Studio 2017.
I know this might not be an ideal or the best solution but at least it worked for us:
I used ProcMon to determine where it was looking for that specific File, for me it turned out to be C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\Extensions\hhfnlhs1.kna
I downloaded the NuGet Package for System.Threading.Tasks.Extensions from NuGet (https://www.nuget.org/packages/System.Threading.Tasks.Extensions/)
I unzipped the Package and stored the DLL at that path from step 1
I had to active "loadFromRemoteSources" in my machine-config (see https://learn.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/dd409252(v=vs.100))
I had to put another DLL from NuGet (https://www.nuget.org/packages/System.Runtime.CompilerServices.Unsafe/4.5.2) into that folder from step 1
That's it - now I can access the DB again.

OpsHub Unable to set Source EndPoint to TFS2015 with error TF31002

I am trying to use OpsHub Visual Studio Migration Utility (Free Version) to migrate the Work Items in TFS2015 (Version 14.102.25423.0) to VSTS.
When I set the TFS server URL as Source EndPoint, I got the TF31002 error as shown in the following screenshot:
TF31002 Error when setting the Source EndPoint to a TFS2015 Server
I am able to connect to the TFS Server via all of my browsers and Visual Studio (2015/2017).
I tried some solutions like:
- clearing IE cache/cookies
- clearing TFS cache
- delete Visual Studio TokenManager folder on registy
Thanks in advance for any provided solution.
My machine is behind a proxy et here are the configuration in settings.properties:
action=update
installationLocation=C:\\Program Files\\OpsHub Visual Studio Migration Utility
httpHostName=my_proxy_ip_address
httpPort=8080
httpUsername=my_company_username
httpPassword=my_password
httpNonProxyHosts=localhost|127.0.0.1
useSameParametersForHTTPS=true
httpsHostName=
httpsPort=
httpsUsername=
httpsPassword=
httpsNonProxyHosts=localhost|127.0.0.1
It seems that you'll have to enable two of the OVSMU's processes to utilize the proxy configuration as done in the _JAVA_OPTIONS environment variable.
C:\Program Files\OpsHub Visual Studio Migration Utility\Other_Resources\Resources\TFSUtility\ovsmu.exe.config
C:\Program Files\OpsHub Visual Studio Migration Utility\Other_Resources\Resources\TFSUtility\TFSService\opshubtfsservice.exe.config
Open each of the above mentioned configuration file in a text editor (as an Admin) and un-comment the following XML node structure.
<!-- <system.net>
<defaultProxy enabled="true" useDefaultCredentials="false">
<module type="com.opshub.tfs.test.Proxy, opshubtfsservice" />
</defaultProxy>
</system.net> -->
Remove the comments and restart the tool, you should be able to connect to the end points then.

WorkFlow designer fails to load in VS 2013

We are using Work Flow's in our project and it is developed in VS 2010. Recently we migrated to VS 2013 Professional. Now when we try to open a Work Flow Activity in VS 2013, we get the following error message:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.SharePoint.WorkflowExtensions, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.VisualStudio.SharePoint.WorkflowExtensions, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'"
We could find the "Microsoft.VisualStudio.SharePoint.WorkflowExtensions.dll" under "C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\WorkflowDesigner", but still when we open the WF designer, we get the FileNotFound exception.
When we close and open the WF again, we get the below error message :
System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at Microsoft.VisualStudio.Activities.EditorPane.set_FileName(String value)
at Microsoft.VisualStudio.Activities.EditorPane.Microsoft.VisualStudio.Shell.Interop.IPersistFileFormat.Load(String fileName, UInt32 formatMode, Int32 readOnly)
Any idea what is causing the issue?
The exception is related to missing Workflow Manager or Workflow Manager Tools on the machine which might not have installed successfully with VS installation at first.
However, you can fix this issue by installing/reinstalling them and dependencies. You might need to restart the machine as well.
Here is the link to download the installers separately: http://www.microsoft.com/en-my/download/details.aspx?id=35375
Looks like we got the root cause now. There were some internet restrictions imposed on the PC's when VS 2013 was installed for which some of the WF related stuffs didn't get downloaded/updated properly.
We tried to re-install VS 2013 without Internet restrictions, and things started to work fine.
Hope this helps someone in need. :)
This worked for me: my workflow was referencing a custom activity I did not have in the /bin folder. Once I placed that custom activity (.dll) into the bin folder, I had no problems.

A constructible type deriving from DbContext could not be found in the selected file (EF Power Tools Beta 2 + VS 2012))

I'm using VS 2012 (Ultimate) together with Entity Framework Power Tools Beta 2 and entity framework 5.0 (using nuget).
I've created a DbContext class. When I right-click on the corresponding file in the solution explorer and select "Entity Framework / View Entity Data Model (Read-only)", I get the error "A constructible type deriving from DbContext could not be found in the selected file." error in VS 2012.
I tried the workaround described at http://blogs.msdn.com/b/adonet/archive/2012/04/09/ef-power-tools-beta-2-available.aspx, but my registry does not contain the key "{BFC24BF4-B994-4757-BCDC-1D5D2768BF29}" in "HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0_Config\BindingPaths\".
After restarting visual studio and following the same steps, a dialog pops up indicating "Exception has been thrown by the target of an invocation".
BTW. I'm able to execute my test application that creates the database from my DbContext and O can insert/delete/etc data in this database.
Any help/hints would be very appreciated.
Kind regards,
Merijn
Uninstalling VSCommands for Visual Studio 2012 should get things working again. Unfortunately, this extension does not play nicely with the EF Power Tools. It loads it's own version of EntityFramework.dll into the main VS process which prevents the DbContext discovery logic from working properly.
As mentioned by Brice, this may be caused by compatibility issue with Visual Studio Extensions.
Latest version of VSCommands fixes this problem. You can get if from Visual Studio Gallery.
Many thanks to Brice and EF Team for their help in diagnosing the problem!
Having seen this error intermittently even without the extensions listed in the other answers, I found deleting the solution's local .suo file worked - although this was very much a when-all-else-fails answer!
I had a similar issue with a different Visual Studio Extension. In my case it was Visual Studio Tools for Git (Version 1.0.0.0).
I just disabled the extension, restarted VS2012 and I was able to use generate the model from a code first EF project.

The term 'Update-Database' is not recognized as the name of a cmdlet

I am using EF5 beta1 and while I was able to run the "Update-Database" before. Now that I shut down Visual Studio, I cannot get it to run. I get the following error:
The term 'Update-Database' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:16
+ Update-Database <<<< -verbose
+ CategoryInfo : ObjectNotFound: (Update-Database:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I have tried to re-install EF5b1 and while was successful (already installed), the 'Update-Database' still does not work.
Can anyone help???
The solution is to close the Package Manager Console, close Visual Studio and then reopen them.
Rebooting also worked most of the time, but not always.
If you use Entity Framework:
Error Message:
"Error Message (from the Update-Database command in the PMC):
The term 'Update-Database' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."
Solution:
Exit Visual Studio. Reopen project and try again.
For more information please visit: Advanced Entity Framework 6 Scenarios for an MVC 5 Web Application (12 of 12)
For anyone who is using .Net Core and EntityFrameworkCore:
You will need to install Microsoft.EntityFrameworkCore.Tools package to resolve this issue.
Read more here: https://learn.microsoft.com/en-us/ef/core/miscellaneous/cli/powershell
Reinstalling the nuget package fixed this issue for me
ie, execute
Install-Package EntityFramework -Version 5.0.0
in the package manager
Sometimes when I load VS, I see this in my package manager console:
Value cannot be null.
Parameter name: path1
I have no idea what causes that yet but it seems that something goes wrong during the start-up of the Powershell console which interrupts the registering of specific modules, such as the EF powershell extensions. You can just manually load it however:
Import-Module .\packages\EntityFramework.6.1.1\tools\EntityFramework.psm1
Make sure you replace 6.1.1 with whatever your current version of Entity Framework is.
you will get this error when the EF tools are not installed properly.
try the below command in Nuget package manager
//Uninstalls and install the same Version of EF
Update-Package "EntityFramework" -reinstall
If you still face the same issue.
create a new Web Project and run the below command in nuget.
(Note : no need to create the new Project in the same solution or
same location.)
// This will update EF to latest version(including the tools)
// if you want to use specific version , use the -version flag.
Update-Package "EntityFramework"
Once this is done, chcek your original project and you can delete the newly created project.
Just restart Visual Studio, it'll solve the problem. Works for me.
Install Microsoft.EntityFrameworkCore.Tools solved the issue for me, used nuget packages
I solved this by uninstalling and reinstalling Microsoft.EntityFrameworkCore and Microsoft.EntityFrameworkCore.Tools
I had this same problem, and the origin of it was on my path name, I had on my path a directory name with straight brackets, like this: C:\[PROJ]\TestApp.
When I removed the brackets, to C:\PROJ\TestApp, it started to work just fine...
Just ReOpen visual studio is work for me
For me the problem was the Nuget version.
uninstall Nuget Package Manager.
restart Visual Studio.
installed new version of Nuget Package Manager.
then re-start Visual Studio again.
This problem seems to happen when you open the project directly from File Explorer. Try starting VS first and then opening the project - worked for me. I'm guessing this is about access to paths.
Most of the time those beta versions have some issues, also if Entity Framework failed to load and also this can happen if you are install the Microsoft.EntityFrameworkCore.Tools globally. try to install it locally into your project
. you can try these steps until you fix the issue. and remember this method is not to fix the issue this is the other way to do this.
cd in to your project directory. not the sln directory to the project directory.
then dotnet ef to find out that you have correctly install the Entity Framework.
then use dotnet ef migrations add "ReplaceThisWithSomeText" command. And this will create new migration.
then use dotnet ef database update to update the database.
Migrations Overview. This will helps too..
Windows commands - cd
(This Is for EFCore projects)
If the other answers don't work (VS 2017): clear the NuGet cache, restart VS, then restore the packages.
I found that it was due to a corrupt package. I had installed Automapper when it was already installed. It was only clear that this package was corrupt when I tried to install another package.
Removing the corrupt package solved this issue for me.
You can then reinstall automapper. The issue was with version 5.4, I am now happily on 6.0.
For me it turns out EntityFramework core was not installed on my project (because i started with blank project). So installing EntityFramework package resolved the problem. Sometimes if EntityFramework installation failed then try to install individual packages one by one
E.g.
Microsoft.EntityFrameworkCore.Design
Microsoft.EntityFrameworkCore.SqlServer
Microsoft.EntityFrameworkCore.SqlServer.Design
Microsoft.EntityFrameworkCore.Tools
I solved by updateing Package Manager Console.
I was not getting Update-Database in Package Manager Console. Then i restart several time. Also restart Windows.
Then I download new one from nuget and then it was solved.
I had this problem in Visual Studio 2015 and resolved it by updating the version of Nuget.
Tools -> Extensions and Updates -> Updates -> Visual Studio Gallery
Simple fix for me was to make sure there was a dash between update and database, like this: update-database and use lowercase. It may be coincidental, but when I did this in Packet Manager Console, the database actually updated and I got the done message rather than the not recognized as the name of a cmdlet, function, script file error.
I started having the same issue after I accidentally opened a Visual Studio solution with Visual Studio 2015 instead of 2017. The project worked just fine before that mishap. It was an older project with EF 5.0 and not EF Core.
I tried everything suggested - restarted Visual Studio countless times, cleaned up NuGet cache, deleted everything in packages folder, reinstalled EF 5 for the project - no good, add-migration was not recognized. If I upgraded EF to 6, it started to recognize the commands, but I did not want to upgrade yet. So, as soon as I reverted back to EF 5, the problem returned.
The only thing that finally saved me was to do the following:
close Visual Studio
delete everything from packages folder
delete .vs folder in the root of your solution. This folder is usually hidden, you have to turn on Show hidden files and folders setting or check Hidden items in folder View tab
start Visual Studio and open your solution. It will ask to restore NuGet packages, agree to it.
Now EF commands finally started working again.
In my case:
Reload project did not help
Restart VS did not help
Restart computer did not help
Reinstal EF did not help
But I found an article where suggestion was to manualy import missing EF package, using PM Conole:
Import-Module .\packages\EntityFramework.X.X.X\tools\EntityFramework.psm1
And this solution solved my problem.
In my case restarting Visual Studio (many, many times) did not work, then as I was looking elsewhere I found a message on the output terminal:
The current .NET SDK does not support targeting .NET Core 2.2. Either
target .NET Core 2.1 or lower, or use a version of the .NET SDK that
supports .NET Core 2.2.
So I installed the required version of .NET Core and the command ran successfully.
I had this problem in VS 2019 with an existing project using EntityFramework 6.3.0. This project had some strange version changes done to it over a period of time, and nothing would get it working. I believe I tried every suggestion listed here with no luck.
Finally, updating to the pre-release version of EntityFramework (currently 6.4.0-preview3-19553-01) did fix the problem, by running this in the Package Manager Console: Update-Package EntityFramework -prerelease. I'm hopeful that when this version is released live in the next few weeks it will work properly.
In my case, I did the following:
- restored missing NuGet packages by clicking "Restore" button on top of the Package Manager Console
- restarted Visual Studio
- run update-database
Restoring NuGet package didn't help me.
I had to reinstall package manager - https://visualstudiogallery.msdn.microsoft.com/4ec1526c-4a8c-4a84-b702-b21a8f5293ca
For me the problem was the Nuget version.
I removed and re-installed Nuget then re-started Visual Studio and then all started working.