Unable to install package UnmanagedExports - c#

In the NuGet Package Manager Console in Visual Studio Express 2012 for Windows 8, I hit
PM > Install-Package UnmanagedExports
I get the following error :
Installing 'UnmanagedExports 1.2.7'.
Successfully installed 'UnmanagedExports 1.2.7'.
Adding 'UnmanagedExports 1.2.7' to JNAExample.
Uninstalling 'UnmanagedExports 1.2.7'.
Successfully uninstalled 'UnmanagedExports 1.2.7'.
Install failed. Rolling back...
Install-Package : Could not install package 'UnmanagedExports 1.2.7'.
You are trying to install this package into a project that
targets'.NETCore,Version=v4.5', but the package does not contain any
assembly references or content files that are compatible with that
framework. For more information, contact the package author.
At line:1 char:1
+ Install-Package UnmanagedExports
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo :
NotSpecified: (:[InstallPackage],InvalidOperationException
+ FullyQualifiedErrorId :
NuGetCmdletUnhandledExceptionNuGet.PowerShell.Commands.InstallPackageCommand
I created a New Project under Visual C# as Class Library.
How to solve this issue ?

The UnmanagedExports NuGet package has an assembly in the lib/net folder inside the NuGet package. Which means it supports projects that target the full .NET Framework, any version. So it does not support UWP projects.
You would need to find another NuGet package, or find the source, if it is available, and compile that in a UWP project or a project that is compatible.

Related

The package requires NuGet client version '3.6.0' or above

I want to install Microsoft.EntityFrameworkCore and its component. I am using Visual Studio 2015 with NuGet Client version previously 3.5.0 and now I have 3.6.0-rtm-2511 (which is the latest) downloaded from https://www.nuget.org/downloads as instructed by error report. I don't know why issue still persist that I need to have 3.6.0 or higher.
How to update my NuGet Package Manager in other way?
I can't find my Nuget Package Manager for Visual Studio in Update from Tools > Extension and Updates > Updates > Visual Studio Gallery.
I can only see it in Tools > Extension and Updates > Installed but there is no update for it but I noticed that 'Automatically update this extension' is checked.
Result from PM Console
PM> install-package microsoft.entityframeworkcore.sqlserver
GET https://api.nuget.org/v3/registration3-gz-semver2/microsoft.entityframeworkcore.sqlserver/index.json
OK https://api.nuget.org/v3/registration3-gz-semver2/microsoft.entityframeworkcore.sqlserver/index.json 329ms
Retrieving package 'Microsoft.EntityFrameworkCore.SqlServer 2.1.1' from 'nuget.org'.
Install failed. Rolling back...
Uninstalling NuGet package Microsoft.EntityFrameworkCore.SqlServer.2.1.1.
Executing nuget actions took 162.34 ms
install-package : The 'Microsoft.EntityFrameworkCore.SqlServer 2.1.1' package requires NuGet client version '3.6.0' or above, but the current NuGet
version is '3.6.0-rtm-2511'. To upgrade NuGet, please go to http://docs.nuget.org/consume/installing-nuget
At line:1 char:1
+ install-package microsoft.entityframeworkcore.sqlserver
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Time Elapsed: 00:00:33.0573364
The package requires NuGet client version '3.6.0' or above
This is a known issue about nuget. NuGet team fixed it for Nuget 4 which comes with VS2017, but 2015 users are left behind.
Ticket: https://github.com/NuGet/Home/issues/6403
Besides, NuGet team will consider a fix. At this time there are no plans to release a new version of NuGet for VS 2015.
So if you want to use the package Microsoft.EntityFrameworkCore.SqlServer 2.1.1, you have to update your Visual Studio 2015 to Visual Studio 2017. Or if the lower version of this package is acceptable to you, you can use the version Microsoft.EntityFrameworkCore.SqlServer 2.0.3
Hope this helps.
Edit the files:
%userprofile%\.nuget\packages\microsoft.entityframeworkcore\3.1.8\microsoft.entityframeworkcore.nuspec
%userprofile%\.nuget\packages\microsoft.entityframeworkcore.abstractions\3.1.8\microsoft.entityframeworkcore.abstractions.nuspec
%userprofile%\.nuget\packages\microsoft.entityframeworkcore.analyzers\3.1.8\microsoft.entityframeworkcore.analyzers.nuspec
%userprofile%\.nuget\packages\microsoft.entityframeworkcore.relational\3.1.8\microsoft.entityframeworkcore.relational.nuspec
%userprofile%\.nuget\packages\microsoft.entityframeworkcore.tools\3.1.8\microsoft.entityframeworkcore.tools.nuspec
Change line 3 from:
<metadata minClientVersion="3.6">
to:
<metadata minClientVersion="3.6.0-rtm-2511">
Now go back to the Package Manager Console and try the install again:
Worked for me.
Try installing the package from Nuget Package Manager (Manage NuGet Packages)and not from console. The package manager will provide you option to update your NUGET application. Look in the 'Visual Studio Gallery' section of the 'Extension and Updates' window that pops up.

Nuget package installation fails although package should be supported

I am trying to install the package Microsoft.Extensions.DependencyInjection.Abstractions in my Visual Studio 2013 solution as part of a Sitecore installation. The solution has .NET target framework 4.5.2.
The installation fails with
Install-Package : Could not install package 'Microsoft.Extensions.DependencyInjection.Abstractions 1.0.0'. You are trying to install this package into a project that targets
'.NETFramework,Version=v4.5.2', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the
package author.
At line:1 char:1
+ Install-Package Microsoft.Extensions.DependencyInjection.Abstractions -Version 1 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
I have tried performing the installation in a completely new, empty solution but the installation still fails.
According to the link, there is a dependency to .NETStandard 1.0 but this should be supported by 4.5 according to this.
JaCraig's commment helped me solve this: I upgraded Nuget Package Manager from 2.8 to 2.12. Afterwards, there were no problems with the installation.

Installing Microsoft.AspNetCore.Mvc

I use Visual Studio Community 2015
Version 14.0.25123.00 Update 2
NuGet Package Manager 3.4.4
When trying to install Microsoft.AspNetCore.Mvc package in a .NET 4.6.1 console Application project, I get the following error:
install-package : Could not install package 'runtime.native.System 4.0.0-rc2-24027'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6.1', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
At line:1 char:1
+ install-package Microsoft.AspNetCore.Mvc -pre
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Can anyone help me out ?
Basically you can not install Microsoft.AspNetCore.Mvc in a console Application. In a console application from Microsoft.AspNetCore.* you can install only Microsoft.AspNetCore.Authentication.ActiveDirectory.
To prove this try this way:
Right click in the references
Chose Manage Nuget Packages...
From 3 tabs (Browse, Installed, Updates) choose Browse tab.
Write in the search box Microsoft.AspNetCore.
The reason you can not install that your application is simply a console app not MVC structure.

Installing Entity Framework fails in Visual Studio 2015

I'm reading/coding along with the Apress book Pro ASP.NET MVC 5 by Adam Freeman. In chapter 7 (p. 174), we're supposed to install Entity Framework using the following commands:
Install-Package EntityFramework -projectname SportsStore.Domain
Install-Package EntityFramework -projectname SportsStore.WebUI
But this fails. Here is the output:
Attempting to gather dependencies information for package 'EntityFramework.6.1.3' with respect to project 'SportsStore.Domain', targeting '.NETFramework,Version=v4.5.1'
Attempting to resolve dependencies for package 'EntityFramework.6.1.3' with DependencyBehavior 'Lowest'
Resolving actions to install package 'EntityFramework.6.1.3'
Resolved actions to install package 'EntityFramework.6.1.3'
Adding package 'EntityFramework.6.1.3' to folder 'C:\git\SportsStore\packages'
Added package 'EntityFramework.6.1.3' to folder 'C:\git\SportsStore\packages'
Added package 'EntityFramework.6.1.3' to 'packages.config'
Executing script file 'C:\git\SportsStore\packages\EntityFramework.6.1.3\tools\init.ps1'
Executing script file 'C:\git\SportsStore\packages\EntityFramework.6.1.3\tools\install.ps1'
Type 'get-help EntityFramework' to see all available Entity Framework commands.
Successfully installed 'EntityFramework 6.1.3' to SportsStore.Domain
Install failed. Rolling back...
Removed package 'EntityFramework 6.1.3' from 'packages.config'
Removing package 'EntityFramework 6.1.3' from folder 'C:\git\SportsStore\packages'
Access to the path 'C:\git\SportsStore\packages\EntityFramework.6.1.3\tools\EntityFramework.PowerShell.Utility.dll' is denied.
Access to the path 'EntityFramework.PowerShell.Utility.dll' is denied.
Removed package 'EntityFramework 6.1.3' from folder 'C:\git\SportsStore\packages'
Install-Package : An item with the same key has already been added.
At line:1 char:1
+ Install-Package EntityFramework -projectname SportsStore.Domain
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
One or more packages could not be completely uninstalled: 'C:\git\SportsStore\packages\EntityFramework.6.1.3'. Restart Visual Studio to finish uninstall.
The book is instructing us to install specific versions of all other libraries (e.g. Microsoft.Aspnet.Mvc 5.0.0), but does not mention which version of EF to install, so I've tried installing different versions of EF, but keep getting the same error. (Install failed. Rolling back...)
I'm running VS2015 as administrator.
Seems NuGet itself was causing these issues (probably related to https://github.com/NuGet/Home/issues/1239, as I was seeing the same 'always rolling back' issue as discussed in that thread)
Updating NuGet solved it for me. (Updated from version 3.0.60624.657 to 3.1.60724.766)
These references were set up earlier in the project:
SportsStore.WebUI -> SportsStore.Domain
SportsStore.UnitTests -> SportsStore.Domain and SportsStore.WebUI
I removed the references for each project and then ran the install-package command for the Entity Framework as directed. That worked fine.
I then re-added the references.
Try to remove all the EF nuget packages installed on your solution and then reinstall the only one that you need.
Try to disconnect references between projects and than try to install EF. Hope it'll help
Relaunching Visual Studio as Admin and retry to install the package did the trick for me.

how to properly install Json.net via nuget for windows phone 7.1 and Silverlight v.4,0

I need to use json.net for json serialization and deserialization, but I have the problem with installing this package. As I saw on the website it supports wp 7.1 and silverilight. When I'm typing in console Install-Package Newtonsoft.Json
Installing 'Newtonsoft.Json 6.0.1'.
Successfully installed 'Newtonsoft.Json 6.0.1'.
Adding 'Newtonsoft.Json 6.0.1' to Connected.
Uninstalling 'Newtonsoft.Json 6.0.1'.
Successfully uninstalled 'Newtonsoft.Json 6.0.1'.
Install failed. Rolling back...
Install-Package : Could not install package 'Newtonsoft.Json 6.0.1'. You are trying to install this package into a project tha
t targets 'Silverlight,Version=v4.0,Profile=WindowsPhone71', but the package does not contain any assembly references or conte
nt files that are compatible with that framework. For more information, contact the package author.
At line:1 char:1
+ Install-Package Newtonsoft.Json
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
How to solve this issue ?
How it should be properly done ?
With windows phone 7, you should probably install the older version of that package, such as 5.0.1. You can do Install-package Newtonsoft.Json -version 5.0.1
right click on dll,in general tab,security section
and unblock it
thanks to :
http://crodrigues.com/referencing-json-net-in-windows-phone-8/

Categories