NuGet / Home

Repo for NuGet Client issues
Other
1.5k stars 252 forks source link

Unable to find / install Microsoft.AspNet.Identity.Core (plus NuGet error at new project time) #6798

Open gojimmypi opened 6 years ago

gojimmypi commented 6 years ago

Details about Problem

I've used this Microsoft.AspNet.Identity.Core package in a prior project: https://www.nuget.org/packages/Microsoft.AspNet.Identity.Core/

Today however, the NuGet Package Manager does not seem to "see" this package.

NuGet product used:

Package Manager Console Host Version 4.6.2.5055 in Visual Studio 2017

dotnet.exe --version

2.1.104

VS version

Microsoft Visual Studio Enterprise 2017 Version 15.6.5 VisualStudio.15.Release/15.6.5+27428.2027 Microsoft .NET Framework Version 4.7.02556

Installed Version: Enterprise NuGet Package Manager 4.6.0

VSCMD_ARG_app_plat=Desktop VSCMD_ARG_HOST_ARCH=x86 VSCMD_ARG_TGT_ARCH=x86 VSCMD_VER=15.6.5

OS version (i.e. win10 v1607 (14393.321)):

WindowsSDKLibVersion=10.0.16299.0

Worked before? If so, with which NuGet version:

yes, but I don't know what version. I created a C# ASP.Net web app Feb 1, 2017 that worked fine.

Detailed repro steps so we can see the same problem

  1. File - New - Project (select Visual C# ASP,Net Web Application); Leave framework set to default 4.6.2

  2. Leave templates as default: Web Forms

Visual Studio gives a "Object reference not set to an instance of an object" error immediately after creating project: image

  1. Click Tools - NuGet Package Manager - Manage NuGet Packages for Solution;

image

  1. Close the solution. Relaunch Visual Studio. Open project. Click Tools - NuGet Package Manager - Manage NuGet Packages for Solution; No Errors and NuGet seems to be working: image

5) Search for "Identity" Online (note Microsoft.AspNet.Identity.Core is not found): image

6) Note old project when searching for "Identity" online has a completely different result list installed (but also not listed in "Browse" online list): image

7) When attempting to manually add, via CLI, this error:

Each package is licensed to you by its owner. NuGet is not responsible for, nor does it grant any licenses to, third-party packages. Some packages may include dependencies which are governed by additional licenses. Follow the package source (feed) URL to determine any dependencies.

Package Manager Console Host Version 4.6.2.5055

Type 'get-help NuGet' to see all available NuGet commands.

PM> Install-Package Microsoft.AspNet.Identity.Core -Version 2.2.1 

Attempting to gather dependency information for package 'Microsoft.AspNet.Identity.Core.2.2.1' with respect to project 'UDataEdit', targeting '.NETFramework,Version=v4.6.2'
Install-Package : Package 'Microsoft.AspNet.Identity.Core 2.2.1' is not found in the following primary source(s): 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'. Please 
verify all your online package sources are available (OR) package id, version are specified correctly.
At line:1 char:1
+ Install-Package Microsoft.AspNet.Identity.Core -Version 2.2.1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Time Elapsed: 00:00:02.8329936
PM> 

My VS NuGet settings: image

image

I've tried selecting older framework; same result.

Sample Project

See https://github.com/gojimmypi/WebApplication4

gojimmypi commented 6 years ago

Workaround for new projects, with access to prior project that worked and had the Microsoft.AspNet.Identity.Core included:

Copy packages directory at the solution level from the older project to the new project:

image

Copy packages.config file from project level directory:

image

In my specific case, packages.config looks like this:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Antlr" version="3.4.1.9004" targetFramework="net452" />
  <package id="AspNet.ScriptManager.bootstrap" version="3.0.0" targetFramework="net452" />
  <package id="AspNet.ScriptManager.jQuery" version="1.10.2" targetFramework="net452" />
  <package id="bootstrap" version="3.0.0" targetFramework="net452" />
  <package id="EntityFramework" version="6.1.3" targetFramework="net452" />
  <package id="jQuery" version="1.10.2" targetFramework="net452" />
  <package id="Microsoft.AspNet.FriendlyUrls" version="1.0.2" targetFramework="net452" />
  <package id="Microsoft.AspNet.FriendlyUrls.Core" version="1.0.2" targetFramework="net452" />
  <package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net452" />
  <package id="Microsoft.AspNet.Identity.EntityFramework" version="2.2.1" targetFramework="net452" />
  <package id="Microsoft.AspNet.Identity.Owin" version="2.2.1" targetFramework="net452" />
  <package id="Microsoft.AspNet.Providers.Core" version="2.0.0" targetFramework="net452" />
  <package id="Microsoft.AspNet.ScriptManager.MSAjax" version="5.0.0" targetFramework="net452" />
  <package id="Microsoft.AspNet.ScriptManager.WebForms" version="5.0.0" targetFramework="net452" />
  <package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.Web.Optimization.WebForms" version="1.1.3" targetFramework="net452" />
  <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.0" targetFramework="net452" />
  <package id="Microsoft.Net.Compilers" version="1.0.0" targetFramework="net452" developmentDependency="true" />
  <package id="Microsoft.Owin" version="3.0.1" targetFramework="net452" />
  <package id="Microsoft.Owin.Host.SystemWeb" version="3.0.1" targetFramework="net452" />
  <package id="Microsoft.Owin.Security" version="3.0.1" targetFramework="net452" />
  <package id="Microsoft.Owin.Security.Cookies" version="3.0.1" targetFramework="net452" />
  <package id="Microsoft.Owin.Security.Facebook" version="3.0.1" targetFramework="net452" />
  <package id="Microsoft.Owin.Security.Google" version="3.0.1" targetFramework="net452" />
  <package id="Microsoft.Owin.Security.MicrosoftAccount" version="3.0.1" targetFramework="net452" />
  <package id="Microsoft.Owin.Security.OAuth" version="3.0.1" targetFramework="net452" />
  <package id="Microsoft.Owin.Security.Twitter" version="3.0.1" targetFramework="net452" />
  <package id="Modernizr" version="2.6.2" targetFramework="net452" />
  <package id="Newtonsoft.Json" version="6.0.4" targetFramework="net452" />
  <package id="Owin" version="1.0" targetFramework="net452" />
  <package id="Respond" version="1.2.0" targetFramework="net452" />
  <package id="WebGrease" version="1.5.2" targetFramework="net452" />
</packages>

To add all the respective references, (edit with something like VSCode) add this ItemGroup to the projectname.csproj file:

  <ItemGroup>
    <Reference Include="EntityFramework">
      <HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</HintPath>
    </Reference>
    <Reference Include="EntityFramework.SqlServer">
      <HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.AspNet.Identity.Core">
      <HintPath>..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.AspNet.Identity.Owin">
      <HintPath>..\packages\Microsoft.AspNet.Identity.Owin.2.2.1\lib\net45\Microsoft.AspNet.Identity.Owin.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.AspNet.Identity.EntityFramework">
      <HintPath>..\packages\Microsoft.AspNet.Identity.EntityFramework.2.2.1\lib\net45\Microsoft.AspNet.Identity.EntityFramework.dll</HintPath>
    </Reference>
    <Reference Include="System.Web.Providers">
      <HintPath>..\packages\Microsoft.AspNet.Providers.Core.2.0.0\lib\net40\System.Web.Providers.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Owin">
      <HintPath>..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Owin.Host.SystemWeb">
      <HintPath>..\packages\Microsoft.Owin.Host.SystemWeb.3.0.1\lib\net45\Microsoft.Owin.Host.SystemWeb.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Owin.Security">
      <HintPath>..\packages\Microsoft.Owin.Security.3.0.1\lib\net45\Microsoft.Owin.Security.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Owin.Security.Facebook">
      <HintPath>..\packages\Microsoft.Owin.Security.Facebook.3.0.1\lib\net45\Microsoft.Owin.Security.Facebook.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Owin.Security.Cookies">
      <HintPath>..\packages\Microsoft.Owin.Security.Cookies.3.0.1\lib\net45\Microsoft.Owin.Security.Cookies.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Owin.Security.Google">
      <HintPath>..\packages\Microsoft.Owin.Security.Google.3.0.1\lib\net45\Microsoft.Owin.Security.Google.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Owin.Security.Twitter">
      <HintPath>..\packages\Microsoft.Owin.Security.Twitter.3.0.1\lib\net45\Microsoft.Owin.Security.Twitter.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Owin.Security.MicrosoftAccount">
      <HintPath>..\packages\Microsoft.Owin.Security.MicrosoftAccount.3.0.1\lib\net45\Microsoft.Owin.Security.MicrosoftAccount.dll</HintPath>
    </Reference>
    <Reference Include="Owin">
      <HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Owin.Security.OAuth">
      <HintPath>..\packages\Microsoft.Owin.Security.OAuth.3.0.1\lib\net45\Microsoft.Owin.Security.OAuth.dll</HintPath>
    </Reference>
  </ItemGroup>