4

My winforms solution was working, but when I re-opened it, some of the references were no longer working. Hence I removed all the references in the project including the references to microsoft dlls.

Now I am trying to add back the references.
What should I do first?

I tried using package manager to add Entity Framework, but got an error. 'EntityFramework 6.1.3' already installed. Failed to add reference to 'System.ComponentModel.DataAnnotations'.

Now When I open package manager, and select On Line, Entity Framework is ticked. However when I select Installed Packages it states "No packages are installed in the current solution"

When I try to build I get an error message

Error   1   This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is E:\EShared\devnet10\SBD.Scheduling\\.nuget\NuGet.targets.  E:\EShared\devnet10\SBD.Scheduling\SBD.Scheduling.Core\SBD.Scheduling.Core.csproj   117 5   SBD.Scheduling.Core

I tried adding a reference to System.ComponentModel.DataAnnotations but it shows in the references with a little yellow exclamation mark.

When I double click the reference icon in solution exporer I get the message

The project cannot be viewed in the object browser because it is unavailable or not yet built

After using version control to revert back to my version with EF6.0.2 , I was then able to install 6.0.3 successfully.

I would still like to know what went wrong.

5
  • did you try this: stackoverflow.com/a/10174457/1845408 Commented Apr 3, 2015 at 3:33
  • Pro Tip: If you installed it with nuget, you need to uninstall it with nuget. Manually editing the references node of your project leaves the packages/projects out of sync. Probably going to need to manually remove reference from packages.config. Commented Apr 3, 2015 at 3:43
  • yes, i removed from packages.config and deleted the EF folder within the packages. Commented Apr 3, 2015 at 3:45
  • it seems i cant add any reference. I am looking into stackoverflow.com/questions/22909506/… Commented Apr 3, 2015 at 3:52
  • 1
    Did you make sure you have the latest version of the Nuget extension on your VS? Commented Apr 3, 2015 at 4:32

2 Answers 2

4
  1. Close your Visual studio.

  2. From the Start screen, right-click the Windows PowerShell app tile (or search for it in the search bar).

  3. Click Run as administrator (Very Important).

  4. Run this command: Set-ExecutionPolicy Unrestricted

  5. Now go back to your visual studio and download your Nuget package(s).

  6. Run this command to set it back to secure setting: Set-ExecutionPolicy Restricted

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I will try this next time I have the problem. I cant remember what I did to work around it at the time.... but Run as administrator sounds familiar and Set-ExecutionPolicy sounds new.
3

You can use this command from the Package Manager Console:

Update-Package –reinstall EntityFramework

If you just want to reinstall everything that is defined in packages.config, use this command:

nuget install packages.config

It will also restore the missing packages.

1 Comment

sadly this did not help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.