Entity Designer for .edmx file doesn't work in VS2010 - visual-studio-2010

I have a .edmx file and I can't open it with the designer. It just opens as plain XML file. When I try to "run custom tool" on it, then it says that:
The custom tool 'EntityModelCodeGenerator' failed. Could not load file or assembly 'Microsoft.Data.Tools.VSXmlDesignerBase, Version=10.0.0.0, ...' or one of its dependencies. The system cannot find the file specified.
And indeed, I don't have this file on my system. I've tried copying it to my machine, but then I get:
An error occurred loading the Entity Data Model Tools Package.
I have VS2010 SP1 Professional installed.
I've tried repairing and reinstalling VS and SP1, and installing some entity packages/patches (I don't remember the exact names of them), but that didn't help. What else can I try?

It appears that my installation package didn't have the L2E tools.

Related

Visual Studio Could not load assembly

I have a C# project using MySql.Data and EntityFramework, and have used the Data Entity Model Wizard to create code based on an existing database. I created the project on a machine running MySql Server 8.0.25 (where I cannot control the installed version), so all my references for MySql packages are also version 8.0.25.
When I moved the project onto my own machine, running MySql Server version 8.0.31, the project successfully builds but has an error message, which Visual Studio says comes from a .edmx file:
Error 4: Could not load file or assembly 'MySql.Data, Version=8.0.31.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) ... ScheduleModel.edmx 7
The file in question only contains the text "MySql.Data" in one place, and that's an un-versioned reference to "MySql.Data.MySqlClient", on line 7.
Since the project builds and appears to run correctly, I don't know if this error affects anything. Regardless, I would like to understand it and why it happens and ideally make it go away.
Here's what I've learned form searching for an answer and trying to investigate/fix the error:
There are no references to version 8.0.31 anywhere in my project, as using Visual Studio to search the entire project for "8.0.31" found no results.
Answers to others' questions tell me the version number in the error message specifies the version of a file that Visual Studio DID find. (Whereas I would have thought the given version number is the one that it is LOOKING for.)
Several places said that the found version is probably in the GAC. Originally, the error message said MySql.Data.EntityFramework (not just MySql.Data), and I did find MySql.Data.EntityFramework in the GAC. (No idea how it got there.) After removing it, the error message changed to just MySql.Data. However, MySql.Data is not in the GAC, and no MySql.Data.* are still there either.
There's a tool called fuslogvw.exe that supposedly can help with this issue, but I could not get it to work. When I run it, there is nothing in the log. When I click on options, all options are grayed out. The one person's recommended registry edit did not work either. (I tried closing and re-opening Visual Studio after said edit, then re-building.)
Process Monitor tells me that, during the build process, no processes accessed any files that include "MySql.Data" in the name except those under packages/MySql.Data.8.0.25 and the project's output directory; all files are version 8.0.25. This appears to conflict with #1, because how can Visual Studio have found version 8.0.31 if it never accessed any such file?
I tried using bindingRedirect in App.config to redirect from 8.0.31 to 8.0.25, which had no apparent effect.
Cleaning the solution and re-building ends up putting MySql.Data version 8.0.25 back into the output directory, so Visual Studio clearly is finding the correct version.
Deleting the packages folder results in everything being replaced (with the right version, again) but the error message persists. (The rebuild was strangely fast; I'd have thought everything would have to be re-downloaded, but it was too fast to have done that.)
How would I diagnose this issue? What might be causing Visual Studio to look for or to find a version that I cannot find any reference to, or any .dll file for?
I'm using Visual Studio Community 2019, Version 16.11.2.

Error occurred while restoring NuGet packages: "Invalid restore input. No target frameworks specified."

How to resolve Visual Studio (MSBuild) error message:
Error occurred while restoring NuGet packages: "Invalid restore input. No target frameworks specified."
WARNING : It seems that you can't work with JetBrains Rider IDE without visual studio!
This issue can happen with Rider IDE if you haven't also installed Microsoft's Visual Studio, along with relevant add-ons libraries dealing with your project (for example Xamarin).
Installing Rider + .NET Framework + MSbuild may not be enough to resolve the issue.
Perhaps it's obvious but not for everybody, in particular developers new to .NET coding.
I had this error recently in a project which builds a NuGet package targeting multiple frameworks.
In brief, I had this in my .csproj file (presumably a git merge error):
<TargetFrameworks>netstandard2.1;net462;net48;net48</TargetFrameworks>
Note the duplicate entry for net48. The odd thing was that it still built on my machine (presumably due to something being cached on disk somewhere). Once I removed the duplicate entry everything started working again.
The problem was caused by wrong project type specified in .sln file. In the solution file the project had type {D954291E-2A0B-460D-934E-DC6B0785DB48} (Shared Project / Windows Store App Universal).
...
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SomeProject", "SomeProject", "{...}"
...
But actually the project is C# (SDK project). The problem was solved by changing the GUID/UUID in the solution file to the correct one, which is {9A19103F-16F7-4668-BE54-9A1E7A4F7556}.
...
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SomeProject", "SomeProject", "{...}"
...

Can't load EntityFramework.dll 5.0.0.0 inside Visual Studio 2013 extension

I'm writing a Visual Studio extension which depends on EntityFramework 5.0.0.0. I included EntityFramework in my project. When I install my extension, my extension's DLL appears in VS extensions folder, and EntityFramework.dll appears with it as well.
However, when I run my Extension in Visual Studio 2013 (update 5), it can't load EntityFramework: System.IO.FileNotFoundException: Could not load file or assembly 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.
Looking in Process Monitor, I saw that when I run my extension, VS2013 tries to load EntityFramework from a different path, which has it in a different version - 4.2. I'd expect VS2013 to continue to search for EntityFramework, and find it in my extension's folder, like it does for other dlls included in my extension, but it doesn't.
In VS2015, VS does manage to load EntityFramework 5.0.0.0, but it does so also from yet another different path.
Why doesn't VS2013 continue to search for EntityFramework in my extension's folder?
You need to specify a ProvideCodeBase attribute to specify that your extra assemblies should be loaded. "Sometimes" you get lucky and it finds something else, but that's never guaranteed to work. You can see a few examples of that being used here.

Visual Studio error while trying to run project

I have the following scenario:
Visual Studio 2010 solution with one WPF-project, output file is "Tool.exe"
Eclipse Shared Library project, output file is "Tool.dll"
I place the dll in the same folder as the exe and then I try to debug using Visual Studio; but I get the following error:
Error while trying to run project: Could not load file or assembly 'Tool' or one of its dependencies. The module was expected to contain an assembly manifest.
I have managed to find a solution to the problem, rename the dll, apparently the exe and dll cannot have the same name. My question is, why is this error occuring in the first place? Why does the name of the dll affect Visual Studio? The error occurs before even trying to pinvoke the dll. If I run my application without Visual Studio it works perfectly, but I want to be able to debug it of course.
Right now renaming the dll is plan B, but before I do that I would like to know if there is anything else I can do to fix this problem?
Thanks in advance.
I found simple steps to solve this error.
1- change your windows.
2- install Symantec Endpoint Protection Client 12.1.6318.6100 x32 or x64 bit.
You can geting it software(32 bit) from link: (ftp://192.168.168.215/Public/Antivirus/Symantec/Symantec Endpoint Protection Client 12.1.6318.6100 x86.rar)
drag and drop it to your software(IE ,....) to work.
3- install all driver on your computer.
4- install Visual studio.
End

The same wixproj file only works in VS 2012 IDE, but not in VS command prompt

I am trying the steps on this page. I have installed the wix binaries in a folder on my local machine.
So I got a wix installer project created by wix VS 2010 plugin. I can use the VS 2010 IDE to build it and generate the msi file, but I cannot do the same thing with Msbuild in the VS command prompt. When Msbuild try to compile, there is an error complaining the candle.exe cannot be found:
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'file:///C:\MyFolder\Wix\candle.exe' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.
I am pretty sure the exe is at the right place because VS IDE can find it. I would like to know what am I missing for Msbuild?
Thank you!
I found answer from here: http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Error-in-candle-during-build-td7385947.html.
Before unzip the binaries, right click on the zip file, select property and choose Unblock from the first tab. Then you unzip it as normal.
As per the page provided by you, the path entered in the lines of code will help the MSBuild script to identify the WIX binaries.
<PropertyGroup>
<WixToolPath>$(SourceCodeControlRoot)\wix\3.6.3220.0\</WixToolPath>
<WixTargetsPath>$(WixToolPath)Wix.targets</WixTargetsPath>
<WixTasksPath>$(WixToolPath)wixtasks.dll</WixTasksPath>
</PropertyGroup>
The important quote here goes like:
WixTargetsPath property value must be relative to the .wixproj project
file that uses it. The WixTasksPath property is used inside
wix.targets to load WixTasks.dll
The paths should be specified properly according to the folders where you unzipped your files. Otherwise there is a chance for this error to happen. Then also the project will be running fine from VS2010 since that is reffering the WIX binaries from the installed location of WIX. But, MSBuild will refer the values you provide in the above lines of code.
So, can you please provide values you are giving for WixToolPath, WixTargetsPath and WixTasksPath. As well the path to where you are unzipping the wix36-binaries.zip or wix37-binaries.zip.
These information may help in solving this issue and accordingly I will correct this answer as well.

Resources