New version of NuGet not working on VS2010 - visual-studio-2010

I've downloaded ASP.NET MVC 3 RC and the new NuGet CTP version.
When I try to install anything in the thru the Package Manager Console I get the an error message. Here are two samples:
PM> nip elmah
Install-Package : Object reference not set to an instance of an object.
At line:1 char:4
+ nip <<<< elmah
+ CategoryInfo : NotSpecified: (:) [Install-Package], NullReferenceException
+ FullyQualifiedErrorId : NuGet.VisualStudio.Cmdlets.InstallPackageCmdlet
PM> nip SQLCE.EntityFramework
Install-Package : Object reference not set to an instance of an object.
At line:1 char:4
+ nip <<<< SQLCE.EntityFramework
+ CategoryInfo : NotSpecified: (:) [Install-Package], NullReferenceException
+ FullyQualifiedErrorId : NuGet.VisualStudio.Cmdlets.InstallPackageCmdlet
When I use the Add Library Package Reference in the Solution Explorer no message is displayed but the package is not installed.
I tried to revert to NuPack and it works fine but the Package list is not updated (for instance SQLCE.EntityFramework 4.0.8435.1 is not been displayed only 4.0.8402.1).
Any help?

I had the same problem. Deleting my packages folder fixed it.

I experienced exactly the same problem.
In the end I had to remove everything from the packages directory and go through each project and run an "update-package" for each package I had previously installed.

Are you pointing to the old feed by any chance? Or an old local feed?

I also had this problem.
I solved it by ensuring that I did packed with the nuspec and dll in the same folder and the nuspec name was mydll.dll.nuspec. When I deviated from this I got said error.

Related

How to use Package Manager Console powershell outside visual studio

I have a powershell script which has nuget commands like:
Get-Project -All
Get-Package -ProjectName
When I run package manager console on visual studio like:
PM> .\download-packages-license.ps1
It worked but I cannot run powershell. I need a hlp.
Powershell error message:
download-packages-license.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/
fwlink/?LinkID=135170.
At line:1 char:1
+ .\download-packages-license.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
How to use Package Manager Console powershell outside visual studio
I am afraid you could not use Package Manager Console powershell outside visual studio. That because package manager console is providing is access to visual studio objects:
https://github.com/NuGet/Home/issues/1512
So, if you want use Package Manager Console powershell outside visual studio, we have to parse the .csproj file or .sln solution file with powershell manually, like:
How do I programmatically list all projects in a solution?
Hope this helps.

The type 'IdentityRole' is defined in an assembly that is not referenced

I'm getting the following error when I attempt to inherit my dbcontext in an asp.net core 2.0 library from IdentityDbContext:
Error CS0012 The type 'IdentityRole' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.Extensions.Identity.Stores, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
When I attempt to install the pkg I get:
Unable to find version '2.0.0' of package 'Microsoft.Extensions.Identity.Stores'.
At line:1 char:1
+ Install-Package Microsoft.Extensions.Identity.Stores -Version 2.0.0
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
I've been going round and round with this for two days. Hopefully a solution will come soon...
Because I had the same problem: Add the nuget package via Package Manager Console to your project.
Install-Package Microsoft.Extensions.Identity.Stores -Version 2.0.2
And choose the correct nuget package version.
Install-Package Microsoft.Extensions.Identity.Store will resolve the problem.

Does xunit understand asp.net5?

I'm trying to get xunit wired up to test an asp.net5 application. If I create a vanilla .dll for my test project, I'm missing a bunch of references, and when I try to add mvc6, I run into problems.
PM> Install-Package Microsoft.AspNet.Mvc -Pre
Install-Package : Failed to add reference to 'System.IO'. Please make sure that it is in the Global Assembly Cache.
At line:1 char:1
+ Install-Package Microsoft.AspNet.Mvc -Pre
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
So, being clever, I thought I'd create my test project with the same asp.net5 template as the project being tested. This gets me the references I need and my test project compiles, but the new project structure screws the discovery. The VS test runner can't find the test .dll (no tests found), and the console test runner, if I point it to the .dll in artifacts\bin[projName]\Debug\dnx451
C:\NotilusTNE\Sources\Hub\[projName]\Dev\[projName]>packages\xunit.runner.con
sole.2.1.0\tools\xunit.console "artifacts\bin\[projName]Tests2\Debug\dnx451\[projName]Tests2.dll"
xUnit.net Console Runner (64-bit .NET 4.0.30319.42000)
System.InvalidOperationException: Unknown test framework: could not find xunit.d
ll (v1) or xunit.execution.*.dll (v2) in C:\NotilusTNE\Sources\Hub\[projName]\
Dev\[projName]\artifacts\bin\[projName]Tests2\Debug\dnx451
Has anyone got xunit successfully testing an asp.net5 application? Surely?
Ok there's only one right way to do this. Specific versions of ASP.NET5 applications need specific versions of xunit, as explained here. Instructions followed to the letter, including creating the .dll type "Class Library (Package)". Hopefully this will be useful to someone.

Manualy install ".nupkg" packages on Visual Studio 2010

I have a pre-released version of SQLite package I downloaded earlier, and I am trying to install it from Package Manager Console, I used
install-package -includeprerelease -Source E:\e
but no success, any tips will be helpful.
edit:
the error message I encountered is:
install-package : Unable to find package 'a'.
At line:1 char:1
+ install-package -includeprerelease -Source E:\e
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
and it occurred after an error in the value entered after this request:
cmdlet Install-Package at command pipeline position 1
Supply values for the following parameters:
Id:
You have not specified the package id in the original command. From the error message it looks like you typed in 'a' for the package id.
install-package SQLite -includeprerelease -Source E:\e
Replace SQLite in the above command with the correct package id for your NuGet package.

install entityframework Error in Visual Studio 2010

I tried to install entityframework from nuget and PM but install stops halfway always.
I get problem with connection and the error is like this
Install-Package : Unable to read data from the transport connection: An existing connection was forcibly close
d by the remote host.
At line:1 char:16
+ Install-Package <<<< EntityFramework
+ CategoryInfo : NotSpecified: (:) [Install-Package], IOException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
Take .zip file for the package by downloading the package as
packages.nuget.org/v1/package/download/AjaxControlToolkit
you can use v2 also in place of v1
then
make a folder D:\BackupNew and copy that AjaxControlToolkit.zip in that folder. This is nuget package but it have extension zip. So open it in zip and save as AjaxControlToolkit.nupkg.
Now it is nuget package to which nuget package manager can recognize easily.
Now add a Package source to Package manager from options of visual studio.
with name as LocalREPO and source url as D:\BackupNew
then open nuget package manager and click on the local nuget package source and install that package from local computer ... finished

Resources