5

I have a WebSite project in VS2010. Folder structure is like:

../packages
../Website
../Website.DataAccess
etc.

I'm trying to open website by opening root folder in VS2010/Open Website. But when I do, it seems to have missing all the references, for example System.Web.Helper, System.Web.Mvc etc. Error messages like:

Could not load file or assembly 'System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

keep showing up.

So why is there even this folder "packages"? Should it automatically let me open website project without worrying about all the references/assemblies?

Is there anything I should do to make the WebSite see the "packages" folder and use it, so I can build this WebSite?

EDIT 1: Also, when trying to install new package from nuget console: install-package system.web.helpers

I get error message: The current environment doesn't have a solution open.

Since this is a WebSite, I don't have a Solution file. Anyway, seems a bit weird to me, that solution file is needed.

andree
  • 3,084
  • 9
  • 34
  • 42
  • 1
    It's controlled by the NuGet package manager. Right click on your solution in the Solution Explorer and see if "Manage Packages" is there. – Lloyd Aug 29 '12 at 14:12
  • I have Nuget installed, but "Manage packages" option isn't there. – andree Aug 29 '12 at 14:28
  • 1
    I just checked, you can click on the project (website) to bring up the package manager if you do not have a references folder. – Mr. Mr. Aug 29 '12 at 14:33

3 Answers3

6

You may be talking about the NuGet packages folder which is created to store the links to the packages you have installed from the NuGet Package Manager.

enter image description here

Go to nuget.codeplex.com and click this button:

enter image description here

Mr. Mr.
  • 4,257
  • 3
  • 27
  • 42
  • "Manage Nuget packages" option isn't accessible, though Nuget is installed. Also, since this is a WebSite project, there isn't references item in the tree. – andree Aug 29 '12 at 14:30
  • Ahhhh that is a vital bit of information, being a website not a project, let me take a look, I don't know the behaviour from my memory. – Mr. Mr. Aug 29 '12 at 14:31
  • Ok, now I see the option. But when I click it, I get "Unable to locate the solution directory. Please ensure that the solution has been saved." But I dont have a solution file for this project, because it is a WebSite. – andree Aug 29 '12 at 14:36
  • No (if I understood the question correctly). All files are copied locally on my PC. – andree Aug 29 '12 at 14:42
  • You need to save the Solution to see "Manage Packages" option. Packages are managed at solution level and not at project level. Try saving the solution file (.sln) and you should find "Manage Packages" option, or can see your NuGet commands working in console. – Nirman Mar 14 '13 at 06:57
4

You need to install the NuGet Visual Studio extension to begin with. You can get it directly within Visual Studio by going to Tools -> Extension Manager and searching online for NuGet - then installing it.

Once installed, you can manage the packages through it - right click on the project node in Solution Explorer and select Manage NuGet Packages... to get the UI.

Check out the answers on How do I get NuGet to install/update all the packages in the packages.config? for details.

Community
  • 1
  • 1
Oded
  • 489,969
  • 99
  • 883
  • 1,009
  • I don't have this option - Manage NuGet Packages - from Solution Explorer. – andree Aug 29 '12 at 14:18
  • You need to go to the link (NuGet.codeplex.com) Oded supplied and download NuGet. – Mr. Mr. Aug 29 '12 at 14:19
  • @andree - Then you don't have `NuGet` installed - follow the instructions `Tools -> Extension Manager` and install it from the Online Gallery. – Oded Aug 29 '12 at 14:20
  • I tried to install packages with nuget.exe, and now all folders from "Packages" are into Website folder. But when opening website from VS2010, references/assebmlies are still missing. – andree Aug 29 '12 at 14:21
  • 2
    @andree - You really should be doing this from within Visual Studio in order for the references to be resolved correctly. – Oded Aug 29 '12 at 14:23
  • NuGet is installed, I can see it in list (Extension Manager/Installed Extensions). And how can I install "packages" from VS? From what I've found, nuget.exe is the only option to install assemblies already on local PC. – andree Aug 29 '12 at 14:26
  • 1
    @andree - Try reinstalling it if you cannot resolve your issue. – Mr. Mr. Aug 29 '12 at 14:29
  • 2
    @andree - Did you _right click_ on the project in Solution Explorer? There should be a `Manage NuGet Packages...` menu item. If you don't, there should be, under the main `Tools` menu a `Libarary Package Manager` option. If they do not exist and you have just installed NuGet, you need to **restart Visual Studio**. – Oded Aug 29 '12 at 14:31
  • Ok, now I see the option. But when I click it, I get "Unable to locate the solution directory. Please ensure that the solution has been saved." But I dont have a solution file for this project, because it is a WebSite. – andree Aug 29 '12 at 14:34
  • 1
    @andree - Are you certain all the dependencies were managed via NuGet? – Oded Aug 29 '12 at 14:37
  • No, I'm not sure. Just to be clear - "Unable to locate the solution directory..." message appears when I click "Manage NuGet Packages" – andree Aug 29 '12 at 14:45
  • @andree - Fair enough. I don't work with WebSites, so can't help further on this. – Oded Aug 29 '12 at 14:46
0

You shouldn't need to "make it work." You can't edit it correctly without NuGet, but it should contain the binary files needed to build your project even without NuGet installed.

Dan Puzey
  • 33,626
  • 4
  • 73
  • 96
  • In that case, seems like it isn't working either with or without NuGet. From what I understand, it should work without configuring anything, but right now it seems like something's missing. – andree Aug 29 '12 at 14:23