17

I 'm trying to install EF7 rc1 to an existing project:

PM> Install-Package EntityFramework.MicrosoftSqlServer –Pre

but I get the following error:

Install failed. Rolling back...
Package 'Microsoft.Extensions.Logging 1.0.0-rc1-final' does not exist in project 'XYZ'

And at in the end of the trace I get this other message:

Install-Package : Failed to add reference to 'System.Collections.Concurrent'. Please make sure that it is in the Global Assembly Cache.

I googled and can see that Concurrent collection have been in dotnet for a while but I have not such assembly in my dev box.

Update:

After querying the gac with gacutil I realize that indeed the assembly is present:

The Global Assembly Cache contains the following assemblies:

System.Collections.Concurrent, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
E-Bat
  • 4,792
  • 1
  • 33
  • 58

7 Answers7

11

As I had no System.Collections.Concurrent assembly in GAC, I installed System.Collections.Concurrent NuGet package:

Install-Package System.Collections.Concurrent

Then manually added reference to packages\System.Collections.Concurrent.4.0.10\lib\dotnet\System.Collections.Concurrent.dll (because net46 folder was empty).

After that, installation of EntityFramework.MicrosoftSqlServer finished with no errors.

gius
  • 9,289
  • 3
  • 33
  • 62
  • 2
    I had the exact same problem and this is what fixed my issue. The accepted answer did not work in my case. I had a 4.6 WPF project which would not install the Nuget package (same errors as the OP). Interestingly, there was no 4.6 dll for System.Collections.Concurrent so I had to use the version in the dotnet folder instead.just like this solution. They are not providing a 4.5/4.6 version of the assembly so NuGet is breaking I think. – Gustyn Feb 20 '16 at 17:12
8

After getting this error, I was able to install EF7 RC1 to my project by removing references to my other projects, after that I was able to install EF7 RC1 succesfully to the project where I needed it, and then added references back, after which solution started to compile (and at least some basic EF functionality starts to work). Probably a glitch of nuget/dnu.

avitenberg
  • 1,781
  • 19
  • 16
  • 1
    This was the way to go in my case too. – E-Bat Dec 04 '15 at 16:59
  • Same issue, however I only got it working after deleting references to other NuGet packages (StructureMap, Caliburn Micro, MahApps Metro, MaterialDesignInXaml, Dragablz, MediatR, FluentValidation). – mycroes Mar 09 '16 at 20:50
3

In my case I had to remove xUnit nuget packages. After removing those references Microsoft.Extensions.Logging 1.0.0-rc1-final installs correctly. Afterward I added xUnit back without any issues.

Tedy Pranolo
  • 1,285
  • 1
  • 14
  • 22
2

If you're getting this now (as in April 2016) then these answers may be out of date. I'm installing EF7 for the first time, but what I found was this :

  • I installed EntityFramework.SqlServer first thinking this was the most 'top level' package I need
  • I tried to install EntityFramework.Commands and got the stupid 'collections' error shown above

I looked carefully at the versions.

  • SqlServer was still Beta 8
  • Commands was RC1

So I went to 'Manage nuget packages' for the project and updated everything shown under updates. I actually had to do this twice.

This then brought the EF7 core stuff up to RC1

I was then able to install EntityFramework.Commands without issue.


BUT this is not what you want to do?

Why? Because they renamed EntityFramework.SqlServer package to EntityFramework.MicrosoftSqlServer

So you actually want to uninstall *.SqlServer and install *.MicrosoftSqlServer

That explains why there was no RC1 version.

Community
  • 1
  • 1
Simon_Weaver
  • 140,023
  • 84
  • 646
  • 689
1

This is a PITA, but using .Net v4.5.2 my workaround for getting EntityFramework.Core -pre installed is:

  1. Create a clean class library with no NuGets installed.
  2. install-package entityframework.core -pre
  3. Copy the content of packages.config but don't include the line representing EntityFramework.Core
  4. Include the lines in the packages.config that you are installing it to.
  5. update-package -reinstall -projectName YourProjectNameFromStep4
  6. install-package EntityFramework.Core -pre

NOTE! If step 5 fails, you can have to do:

  1. install-package System.Collections.Concurrent -version 4.0.0 -projectName YourProjectNameFromStep4
  2. install-package System.Runtime -version 4.0.0 -projectName YourProjectNameFromStep4

These can then be removed after the install from step 6 succeeds:

  1. uninstall-package System.Collections.Concurrent -projectName YourProjectNameFromStep4
  2. uninstall-package System.Runtime -projectName YourProjectNameFromStep4

After restart of Visual Studio it might say "Can not find System.Collections.Concurrent but closing your eyes for this seems to work.

Daniel
  • 8,133
  • 5
  • 36
  • 51
0

Same problem here. I uninstalled ef7-beta8 and its dependences and reinstalled ef7... Problem solved, so it seems there is a bug on the update logic or in nuget itself, don't know for sure.

0

As a workaround, I created a new project, installed EF 7, added previous source files manually and it worked.

Rana Ian
  • 724
  • 7
  • 6