The referenced component 'EntityFramework'

2019-01-23 03:36发布

So im downloading a project at home from work over team foundation server. I download the project and it won't compile because of the error. Warning 2 The referenced component 'EntityFramework' could not be found. Could anyone offer guidance in how I can get entity framework to work. I installed nuget package.

Thankyou

5条回答
我欲成王,谁敢阻挡
2楼-- · 2019-01-23 04:00

There are good ways suggested by the developers, you may also try this solution to solve your problem.

In your case your project has a reference to the EntityFramework library, but library it self is not available to you project. You may try either the following:

  • If you have NuGet package manager:

Click on Project-> Manage NuGet Packages. It will open following window.

Find the EntityFramework and click Install.

NuGet Package Window


- Alternatively, Download the EntityFramework library to your computer, then

Right-Click the Prject-> Add References...-> Browse-> Locate your EntityFramework library-> Click OK

Like this image


- Optionally you may use package manager to install library reference,
check this link package-manager-console (Note: This might require NuGet Package manager)

查看更多
姐就是有狂的资本
3楼-- · 2019-01-23 04:12

I had the same problem. I solved it like this:

  1. Choose References > Right-click > Add Reference ...
  2. Choose Browse tab
  3. Find your Project Folder > packages > EntityFramework.4.1.10331.0 > lib
  4. Choose EntityFramework.dll
  5. Click OK
查看更多
淡お忘
4楼-- · 2019-01-23 04:17

This happened to me, after I moved projects to a subfolder. Then, the relative paths to the packages folder were not correct anymore.

Got errors like that:

This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\NETStandard.Library.2.0.1\build\netstandard2.0\NETStandard.Library.targets. PROJECTNAME D:\VSTS\TEAMPROJECT\src\PROJECTFOLDER\PROJECTNAME.csproj

enter image description here

Fixed it by editing the *.csproj file and corrected the relative paths, in my case from ..\packages to ..\..\packages

Also make sure to check the paths under

<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
查看更多
Viruses.
5楼-- · 2019-01-23 04:20

I suggest you to check:

1) "Allow NuGet to download missing packages during build" ticked

Tool --> Options... --> Package Manager --> General enter image description here

2) "Project selected" ticked

Solution Explorer --> right-click on the solution/project --> Manage NuPackages enter image description here

3) Rebuild Solution

enter image description here

EDIT

For completeness I would like to add that if you are working with a CI system (e.g. Jenkins) or you are using MSBuild on the command line, you need to select Enable NuGet Package Restore to make it work:

Enable NuGet Package Restore http://docs.nuget.org/docs/Workflows/images/enable-package-restore.png

查看更多
戒情不戒烟
6楼-- · 2019-01-23 04:23

I solved this issue by adding Entity Framework reference (Add ref) under C:\ Prog Files\Entity...\Binaries\Entity Framework.dll into my project. Hope this helps!

查看更多
登录 后发表回答