locked
NuGet install packages problem RRS feed

  • Question

  • User-1793215261 posted

    Hello

    I have a Web Forms project that requires me to install the Crypto and Well-Helpers packages from NuGet. I have the latest version of Visual Studio Community (version 15.9.1) - it was updated on 16th Nov.

    In Visual Studio, when I go to Tools | NuGet Package Manager | Package Manager Console (Package Source: All) and type in:

    Install-Package System.Web.Helpers.Crypto -Version 3.2.3

    from here:  NuGet  I get the following error:

    Install-Package : Project 'Default' is not found.
    At line:1 char:1
    + Install-Package System.Web.Helpers.Crypto -Version 3.2.3
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (Default:String) [Install-Package], ItemNotFoundException
    + FullyQualifiedErrorId : NuGetProjectNotFound,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

    I then tried to install the Web-Helpers package from here: NuGet and get:

    Install-Package : Project 'Default' is not found.
    At line:1 char:1
    + Install-Package WebHelpers -Version 4.0.2
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (Default:String) [Install-Package], ItemNotFoundException
    + FullyQualifiedErrorId : NuGetProjectNotFound,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand


    I then tried to update the packages I think I have, but get the following:

    PM> Update-Package
    Update-Package : Project 'Default' is not found.
    At line:1 char:1
    + Update-Package
    + ~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (Default:String) [Update-Package], ItemNotFoundException
    + FullyQualifiedErrorId : NuGetProjectNotFound,NuGet.PackageManagement.PowerShellCmdlets.UpdatePackageCommand

    PM>

    I am not sure what the problem may be.

    Thanks.

    Monday, November 19, 2018 10:24 AM

All replies

  • User753101303 posted

    Hi,

    The nuget console includes a default proejct dropdown as show here : https://docs.microsoft.com/en-us/nuget/tools/package-manager-console#opening-the-console-and-console-controls

    From my test I have the same error if the default project is blank because the projet file is unloaded in solution explorer. Make sure you selected a default project. If none can be shown you are 100% sure you loaded your solution and the project file is not unloaded ?

    Monday, November 19, 2018 11:05 AM
  • User-1793215261 posted

    Yes, I have my Web Forms project open. The Solution Explorer files appear down the right-hand side of the screen; Package Manager Console window is open at the bottom (I have just tried Update-Package again but get the same error); My register.aspx.vb file with its Crypto/Hash code is open in the main window.

    Thanks again.

    Monday, November 19, 2018 11:24 AM
  • User753101303 posted

    And you do have a default project selected in the nuget console ?

    As I told it works fine here unless the selected project is blank (I see something else if no solution is opened, I see the same error than you only if the project file is unloaded). See perhaps https://codedocu.com/Net-Framework/Visual-Studio/VS-2017/Visual-Studio-2017_colon_-The-ProjectFile-is-unloaded_dot_-Project-Unavailable?1942

    Monday, November 19, 2018 12:17 PM
  • User-893317190 posted

    Hi Bluenose,

    Your project version may be not compatible with your nuget. You could create a new solution and create a project in the solution. Then you could  try to install a package into the new solution.

    If it is ok, you could  make your old project refer to the downloaded dll in your new project instead of using nuget.

    Right click your project that could install package, click open Folder In File Explorer  and double click the bin folder , all the dll of the project is in the folder.

    Then you could right click your older project's reference and choose add reference, in the pop-up wizard, click browser button at the bottom and choose the downloaded dll and then click ok.

    If you nuget could download package , it should ok.

    However, if it is your nuget that has problem, maybe you should reinstall your nuget.

    Please refer to the link below, it has detailed discussion.

    https://github.com/NuGet/Home/issues/1215

    Best regards,

    Ackerly Xu

    Tuesday, November 20, 2018 3:00 AM
  • User-1793215261 posted

    Regarding creating a new project to test out NuGet.

    When I go to File | Project | New, I choose Windows Forms App and Form1 loads in my main window. In Solution Explorer, I click on 'Solution 'WindowsApp1' (1 project)' to highlight it. I then right-click on select 'Restore NuGet packages'.

    In my Package Manager Output pane at the bottom of the main window, I get this:

    All packages are already installed and there is nothing to restore.
    Time Elapsed: 00:00:00.6192958
    ========== Finished ==========

    There is no item for 'Reload Project' when I right-click on 'Solution 'WindowsApp1' (1 project)' in Solution Explorer.

    When I load my own project in VS, at the top of the Solution Explorer 'tree', I see my project's own folder followed, in brackets, by the path of that project in Visual Studio 2017 - that is, where the project is located on my hard drive.

    If I right-click on that top folder, I see only

    Add
    Go to Git Changes
    Configure tasks
    Debug and Launch settings
    Copy
    Open folder in File Explorer
    Open Developer Command Prompt
    Copy path

    There are no items for 'Restore NuGet packages' or 'Reload Project'.

    Thanks again.

    Thursday, November 22, 2018 12:51 PM
  • User-893317190 posted

    Hi Bluenose,

    Could you use nuget to install package in your newly created project?

    If you need System.Web.Helpers.Crypto you could create a MVC (c# or VB) project, there is dll of Crypto in the project.

    And you could make your old project refer to the dll of your newly created project.

    For my Solution WebApplication1, the dll is in WebApplication1\packages\Microsoft.AspNet.WebPages.3.2.4\lib\net45 folder.

    If you couldn't use your nuget to install any package in your newly created project, maybe there is something wrong in you nuget package.

    You could go to nuget to solve your problem. https://github.com/NuGet/Home/issues

    Best regards,

    Ackerly Xu

    Friday, November 23, 2018 7:46 AM
  • User-1793215261 posted

    Thanks Ackerly Xu

    When I open up a new project in VS Express 2013 for Web, I am able to install the following:

    Install-Package System.Web.Helpers.Crypto -Version 3.2.3
    Install-Package WebHelpers -Version 4.0.2

    When I type in exactly the same commands in VS 2017 Community, I still get those errors:

    PM> Install-Package System.Web.Helpers.Crypto -Version 3.2.3
    Install-Package : Project 'Default' is not found.
    At line:1 char:1
    + Install-Package System.Web.Helpers.Crypto -Version 3.2.3
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (Default:String) [Install-Package], ItemNotFoundException
    + FullyQualifiedErrorId : NuGetProjectNotFound,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

    PM> Install-Package WebHelpers -Version 4.0.2
    Install-Package : Project 'Default' is not found.
    At line:1 char:1
    + Install-Package WebHelpers -Version 4.0.2
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (Default:String) [Install-Package], ItemNotFoundException
    + FullyQualifiedErrorId : NuGetProjectNotFound,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

    PM>

    It would seem, therefore, that the problem is unrelated to my Internet connection or Nu-Get itself, but my copy of VS 2017 Community, though I have version 15.9.1 installed.

    Would it be worthwhile reinstalling VS 2017 Community? If so, do I uninstall my VS 2017 Community first or will another installation simply paste over what I presently have?

    Thanks

    Monday, November 26, 2018 12:07 PM
  • User475983607 posted

    As suggested several times above, be sure to select a default project in the PMC. 

    Monday, November 26, 2018 12:21 PM
  • User-1793215261 posted

    In the Package Manager Console, I can see Default Project which is blank. Alongside the blank field there is a downward pointing arrow as if I am expecting a list to appear when I click it. When I do click on it, there is no list and the field remains blank.

    In the main window, above my Package Manager Console window pane located along the bottom of my screen, is the code for my register.aspx.vb file.

    Thanks.

    Monday, November 26, 2018 1:37 PM
  • User475983607 posted

    Bluenose

    In the Package Manager Console, I can see Default Project which is blank. Alongside the blank field there is a downward pointing arrow as if I am expecting a list to appear when I click it. When I do click on it, there is no list and the field remains blank.

    There is something wrong with your project/solution.  It sounds like you are not using the visual studio solution or project files and are accessing the code files directly from a folder.

    You'll need to fix the solution to use NuGet or download the library and manually add the library to the bin folder.

    Monday, November 26, 2018 2:40 PM
  • User-1793215261 posted

    Yes, I have the VS 2017 icon in my Start Up menu and right-click it. The latest project appears at the top of the list as a folder with the path to that folder showing, so I just double click on that folder and it opens in VS 2017.

    I have downloaded nuget.exe - recommended latest v4.8.1 from here https://www.nuget.org/downloads. I am hoping that contains the Web Helpers and Crypto packages.

    Thanks.

    Monday, November 26, 2018 3:07 PM
  • User475983607 posted

    Yes, I have the VS 2017 icon in my Start Up menu and right-click it. The latest project appears at the top of the list as a folder with the path to that folder showing, so I just double click on that folder and it opens in VS 2017.

    I have downloaded nuget.exe - recommended latest v4.8.1 from here https://www.nuget.org/downloads. I am hoping that contains the Web Helpers and Crypto packages.

    I recommend fixing the solution/project so you can take advantage of the Visual Studio tool chain.  

    Monday, November 26, 2018 3:11 PM
  • User753101303 posted

    So as the drop down is blank it seems you really don't have current project. This is a "web application project" or maybe rather a "web site project" ? Could it be that this file is opened in "Solution items" rather than really as part of a project.

    Monday, November 26, 2018 3:25 PM
  • User-1793215261 posted

    When I have the project loaded in VS 2017, I can see the various folders, Account, Bin, plus several aspx and asp.vb files in Solution Explorer. They all load in the main window of VS when I double click on them.

    Monday, November 26, 2018 5:07 PM
  • User475983607 posted

    When I have the project loaded in VS 2017, I can see the various folders, Account, Bin, plus several aspx and asp.vb files in Solution Explorer. They all load in the main window of VS when I double click on them.

    Open the solution/project by clicking on the solution/project file.  Visual Studio allows opening a folder.  If you go this route then you lose useful tools, like the ability to build, referenced project intellisense,  compiler warnings, debugging, NuGet, and of course the PMC's default project is empty as there's no solution loaded.

    I recommend loading a solution/project so you can take advantage Visual Studio features.  It should help you find and fix errors more efficiently.

    Monday, November 26, 2018 6:11 PM
  • User753101303 posted

    I would still suggest testing with a new project : https://docs.microsoft.com/en-us/visualstudio/ide/creating-solutions-and-projects?view=vs-2017#to-create-a-project-from-a-project-template

    (really try "New" "Project")

    and then an ASP.NET Web application. Is the project drop down still empty then? As long as it is, it is expected it won't work. For now it seems you are not using VS as it should at least for this project ???

    Monday, November 26, 2018 6:17 PM
  • User-1793215261 posted

    In VS 2017, I have gone to File | Project | ASP.NET Web Application (.NET Framework) and called it Test1 with a .NET Framework 4. I click OK, and have an empty file. I press OK again and the project loads.

    Solution Explorer looks bare (no aspx files or folders). In Package Manger Console, I have Package source: All and in Default project, I have Test1.

    This is what I now get when I try to install the packages:

    PM> Install-Package System.Web.Helpers.Crypto -Version 3.2.3

    Installing System.Web.Helpers.Crypto 3.2.3.

    Successfully installed 'System.Web.Helpers.Crypto 3.2.3' to Test1

    PM> Install-Package WebHelpers -Version 4.0.2

    Installing WebHelpers 4.0.2.

    Successfully installed 'WebHelpers 4.0.2' to Test1

    PM>

    How does that help me with the packages I am hoping to install for my project?

    Thanks again, Patrice

    Monday, November 26, 2018 8:46 PM
  • User753101303 posted

    This is to make sure VS works as expected. It seems really something wrong in how you are using your other "project". More likely you are just opening a folder rather than really opening a project file?

    Do you have a .csproj (or .vbproj) file for this project ??? If yes, double click this file to properly open your projet. If not you'll have to create a real project before being able to install those packages.

    If still having issues posting a screenshot maybe help to figure out what is wrong in your current approach.

    Tuesday, November 27, 2018 10:48 AM
  • User-1793215261 posted

    I started a new project in VS 2017: ASP.NET Web Application (.NET Framework).

    In the Package Manager Console, I can see the name of my project.

    There is an error (yawn, yawn): 'Unable to fine version 2.0.1 Micrpsoft.AsoNet.Providers.LocalDB'

    I have copied and pasted all the folders and files from my old project into this new one.

    'There were errors building the project...'

    Severity Code Description Project File Line Suppression State
    Error BC30506 Handles clause requires a WithEvents variable defined in the containing type or one of its base types. DimaDayoub C:\Users\Steve\Documents\Visual Studio 2017\Projects\DimaDayoub\DimaDayoub\Account\mgebhardLogin.aspx.vb 14 Active
    Error BC30506 Handles clause requires a WithEvents variable defined in the containing type or one of its base types. DimaDayoub C:\Users\Steve\Documents\Visual Studio 2017\Projects\DimaDayoub\DimaDayoub\logon.aspx.vb 76 Active
    Error BC30506 Handles clause requires a WithEvents variable defined in the containing type or one of its base types. DimaDayoub C:\Users\Steve\Documents\Visual Studio 2017\Projects\DimaDayoub\DimaDayoub\register.aspx.vb 92 Active
    Error BC30506 Handles clause requires a WithEvents variable defined in the containing type or one of its base types. DimaDayoub C:\Users\Steve\Documents\Visual Studio 2017\Projects\DimaDayoub\DimaDayoub\userpage.aspx.vb 119 Active
    Error BC30506 Handles clause requires a WithEvents variable defined in the containing type or one of its base types. DimaDayoub C:\Users\Steve\Documents\Visual Studio 2017\Projects\DimaDayoub\DimaDayoub\userpage.aspx.vb 220 Active
    Error BC30506 Handles clause requires a WithEvents variable defined in the containing type or one of its base types. DimaDayoub C:\Users\Steve\Documents\Visual Studio 2017\Projects\DimaDayoub\DimaDayoub\userpage_mgebhard.aspx.vb 32 Active
    Error BC30506 Handles clause requires a WithEvents variable defined in the containing type or one of its base types. DimaDayoub C:\Users\Steve\Documents\Visual Studio 2017\Projects\DimaDayoub\DimaDayoub\userpage_mgebhard.aspx.vb 75 Active
    Warning BC40056 Namespace or type specified in the Imports 'Microsoft.AspNet.Membership.OpenAuth' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. DimaDayoub C:\Users\Steve\Documents\Visual Studio 2017\Projects\DimaDayoub\DimaDayoub\Account\Manage.aspx.vb 5 Active
    Warning BC40056 Namespace or type specified in the Imports 'Microsoft.AspNet.Membership.OpenAuth' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. DimaDayoub C:\Users\Steve\Documents\Visual Studio 2017\Projects\DimaDayoub\DimaDayoub\Account\OpenAuthProviders.ascx.vb 1 Active
    Warning BC40056 Namespace or type specified in the Imports 'DotNetOpenAuth.AspNet' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. DimaDayoub C:\Users\Steve\Documents\Visual Studio 2017\Projects\DimaDayoub\DimaDayoub\Account\RegisterExternalLogin.aspx.vb 2 Active
    Warning BC40056 Namespace or type specified in the Imports 'Microsoft.AspNet.Membership.OpenAuth' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. DimaDayoub C:\Users\Steve\Documents\Visual Studio 2017\Projects\DimaDayoub\DimaDayoub\Account\RegisterExternalLogin.aspx.vb 3 Active
    Warning BC40056 Namespace or type specified in the Imports 'Microsoft.AspNet.Membership.OpenAuth' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. DimaDayoub C:\Users\Steve\Documents\Visual Studio 2017\Projects\DimaDayoub\DimaDayoub\register.aspx.vb 1 Active
    Warning BC40056 Namespace or type specified in the Imports 'System.Web.Helpers' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. DimaDayoub C:\Users\Steve\Documents\Visual Studio 2017\Projects\DimaDayoub\DimaDayoub\register.aspx.vb 9 Active
    Warning BC40056 Namespace or type specified in the Imports 'Microsoft.AspNet.Membership.OpenAuth' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. DimaDayoub C:\Users\Steve\Documents\Visual Studio 2017\Projects\DimaDayoub\DimaDayoub\userpage.aspx.vb 1 Active
    Warning BC40056 Namespace or type specified in the Imports 'Microsoft.AspNet.Membership.OpenAuth' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. DimaDayoub C:\Users\Steve\Documents\Visual Studio 2017\Projects\DimaDayoub\DimaDayoub\userpage_mgebhard.aspx.vb 1 Active
    Warning BC40056 Namespace or type specified in the Imports 'Microsoft.AspNet.FriendlyUrls.Resolvers' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. DimaDayoub C:\Users\Steve\Documents\Visual Studio 2017\Projects\DimaDayoub\DimaDayoub\ViewSwitcher.ascx.vb 1 Active

    I get the same error as before when I load the page in Chrome:

    Compilation Error
    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: BC30456: 'Helpers' is not a member of 'Web'.

    Source Error:


    Line 72: Private Sub CreateAccount(ByVal username As String, ByVal password As String, ByVal email As String)
    Line 73:
    Line 74: Dim hashedPassword As String = System.Web.Helpers.Crypto.HashPassword(password)

    Thanks again.

    Tuesday, November 27, 2018 9:33 PM
  • User475983607 posted

    Perhaps if you zip your project and make it available a forum member will fix it for you.  Otherwise, the error are due to copying the files and expecting it to work.  The ASPX pages and CS files must be registered in the project file.  Basically, included in the project.  Once you get the project setup correctly, you'll be able to fetch the Web Matrix libraries.

    Tuesday, November 27, 2018 9:50 PM
  • User-1793215261 posted

    Hello

    When I opened my VS 2017 Web forms project earlier, the Package Manager Console invited me to 'Restore packages'. So, I pressed the Restore button and a number of packages were successfully restored.

    However, the Package Manager Console informs me that 'Microsoft.AspNet.Providers.LocalDB" version="2.0.1" could not be found on 'source C:\Program Files (x86)\Microsoft SDKs\NuGet Packages\. https://asp.nuget.org/v3/index.json. An error occured while sending the request. The remote name could not be resolved: 'api.nuget.org.'

    However, in the packages.config file, I can see 'Microsoft.AspNet.Providers.LocalDB" version="2.0.1"

    <?xml version="1.0" encoding="utf-8"?>
    <packages>
    
      <package id="AspNet.ScriptManager.jQuery" version="1.8.2" targetFramework="net40" />
      <package id="AspNet.ScriptManager.jQuery.UI.Combined" version="1.8.24" targetFramework="net40" />
      <package id="DotNetOpenAuth.AspNet" version="4.1.4.12333" targetFramework="net40" />
      <package id="DotNetOpenAuth.Core" version="4.1.4.12333" targetFramework="net40" />
      <package id="DotNetOpenAuth.OAuth.Consumer" version="4.1.4.12333" targetFramework="net40" />
      <package id="DotNetOpenAuth.OAuth.Core" version="4.1.4.12333" targetFramework="net40" />
      <package id="DotNetOpenAuth.OpenId.Core" version="4.1.4.12333" targetFramework="net40" />
      <package id="DotNetOpenAuth.OpenId.RelyingParty" version="4.1.4.12333" targetFramework="net40" />
      <package id="EntityFramework" version="6.1.3" targetFramework="net40" />
      <package id="jQuery" version="1.8.2" targetFramework="net40" />
      <package id="jQuery.UI.Combined" version="1.8.24" targetFramework="net40" />
      <package id="MarkdownSharp" version="1.13.0.0" targetFramework="net40" />
      <package id="Microsoft.AspNet.FriendlyUrls.Core" version="1.0.0" targetFramework="net40" />
      <package id="Microsoft.AspNet.Membership.OpenAuth" version="2.0.1" targetFramework="net40" />
      <package id="Microsoft.AspNet.Providers.Core" version="2.0.0" targetFramework="net40" />
      <package id="Microsoft.AspNet.Providers.LocalDB" version="2.0.1" targetFramework="net40" />
      <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net40" />
      <package id="Modernizr" version="2.6.2" targetFramework="net40" />
      <package id="System.Web.Helpers.Crypto" version="3.2.3" targetFramework="net40" />
      <package id="WebHelpers" version="4.0.2" targetFramework="net40" />
    </packages>

    How can I correct this, please? In the Package Manager Console itself, I have 'All' under 'Package source' and the name of my project under 'Default project'. 

    What I have noticed is that in the packages.config file above, there is a green underline under 'packages' here:

    <?xml version="1.0" encoding="utf-8"?>
    
    <packages>
    

    with the error: 'The 'packages' is not declared'.

    Thanks again.

    Wednesday, December 5, 2018 2:35 PM
  • User-1793215261 posted

    The discussion here https://stackoverflow.com/questions/31082137/unable-to-find-localdb-nuget-package suggests that version 2.0.1 of the LocalDB is bogus, which would explain why I am getting an error in VS 2017 Package Manager Console: 'Unable to find version 2.0.1 of Microsoft.AspNet.Providers.LocalDB (though I can see it in the packages config
    file.

    So, I went to Tools | Package Manager | Manage Settings and put a tick alongside:

    Allow NuGet to download missing packages
    Automatically check for missing packages
    Press 'Clear all cache' button.

    I then restarted my project and VS 2017 and, in the Package Manager Console, typed in:

    Install-Package Microsoft.AspNet.Providers.LocalDB -Version 2.0.0.

    (in accordance with the syntax here: https://docs.microsoft.com/en-us/nuget/tools/ps-ref-install-package

    Now I get the same message: 'Unable to find version 2.0.1 of Microsoft.AspNet.Providers.LocalDB. Apparently, I need to 'restore missing packages before performing any operations'. So I click the Restore button again and get the same message.

    Where do I go from here, please?

    Friday, December 7, 2018 3:17 PM