How can I use netstandard2 using .net Framework 4.5? - visual-studio-2013

I'm trying to install the package WebSocketSharp.Standard but I getting installing error.
Install-Package : Could not install package 'WebSocketSharp.Standard 1.0.3'. You are trying to install this package into a project that targets '.NETFramework,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 WebSocketSharp.Standard -Version 1.0.3
CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
I download the NuGet and extract and I check the library only the netstandard2.0
how can I use the package in my current project? Im using VS2013.

.Net standard 2.0 support works starting with .net framework 4.6.1, but you get a lot of system DLLs next to your app. So use .net 4.8 and not 4.6.x.
The minimum requirement to use .net standard libs is to use Visual Studio 2015 (with the update 3 + a special hotfix), but it is better to use VS2017 or 2019:
If you only need to consume .NET Standard 2.0 libraries in your
projects, you can also do that in Visual Studio 2015. However, you
need NuGet client 3.6 or higher installed.
So your VS2013 is too old.

Related

Why can I install NuGet v4.0.10 in VS2019 but not in VS2012?

I want to get Npgsql for a project targeting .Net 4.5 in Visual Studio 2012. It appears the latest Npgsql version supporting that version of .Net is 4.0.10. In Visual Studio 2012, with package source set to nuget.org, I got the following:
PM> Install-Package Npgsql -Version 4.0.10
Install-Package : Unable to find version '4.0.10' of package 'Npgsql'.
At line:1 char:16
+ Install-Package <<<< Npgsql -Version 4.0.10
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
But in Visual Studio 2019, with the same source, the package was installed successfully. What do I have to do to install it in my VS2012 project?
But in Visual Studio 2019, with the same source, the package was
installed successfully. What do I have to do to install it in my
VS2012 project?
First, thanks to Lex for sharing the useful info with us.
Since VS2012 is too old to maintain it, the highest version of Nuget in VS2012 is v2.8.60318.667. And Npgsql 4.0.10 needs nuget v4.xxx or above which is not supported in VS2012.
Solution
If you want to install this nuget package in VS2012, you cannot install the latest version(4.0.10) of the Npgsql nuget package, you should install the version which nuget v2.8.60318.667 supports.
And Npgsql 3.1.10 is supported in VS2012 which l have tested successfully.
1) If the nuget version in VS2012 is not the latest, you should update nuget version to the latest v2.8.60318.667. (Tools-->Extensions and Updates-->Updates)
2) Open Package Manage Console by Tools-->Nuget Package Manager-->Package Manager Console and type this:
Install-Package Npgsql -Version 3.1.10
Update
Just install an old version of Npgsql (<=3.1.10)
Hope it could help you.

Installing Ext.NET via nuget error: 'Newtonsoft.Json' already has a dependency defined for 'Microsoft.CSharp'

I am trying to install Ext.NET on Visual Studio 2012 via Package Manager Console but I receive this error:
'Newtonsoft.Json' already has a dependency defined for
'Microsoft.CSharp'
Here is the full process:
Install-Package Ext.NET
Attempting to resolve dependency 'Ext.NET.Utilities (≥ 2.5.0)'.
Attempting to resolve dependency 'Transformer.NET (≥ 2.1.1)'.
Attempting to resolve dependency 'Newtonsoft.Json (≥ 10.0.2)'.
Install-Package : 'Newtonsoft.Json' already has a dependency defined for 'Microsoft.CSharp'.
At line:1 char:1
+ Install-Package Ext.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
*Nuget version: 2.8.60318.667
What Matt Ward said is perfectly correct. You can notice that one dependency restriction for package Ext.NET is Newtonsoft.Json (>= 10.0.2):
There is a dependency restriction for .NETStandard 1.0 framework of Newtonsoft.Json: Microsoft.CSharp (>= 4.3.0), you can check it from Json.NET 10.0.2. However, NuGet not support the newer .NETStandard frameworks until NuGet 2.12, you can get this information from NuGet release note 2.12.
Full NetStandard and NetCoreApp support for VS2013.
We could not use NuGet 2.12 on the Visual Studio 2012, so to resolve this issue, you can update your Visual Studio 2012 to Visual Studio 2013 or manage that assembly Manually, but this will bring a lot of tasks.

Unable to Add System.ServiceModel Nuget Package in Xamarin Form PCL Project

I am trying to follow the official xamarin tutorial to make use of WCF Services from a Xamarin Form PCL project (URL /guides/cross-platform/application_fundamentals/web_services/walkthrough_working_with_WCF/ on Xamarin website)
However, at the time of referencing the System.ServiceModel nuget package, I get the following error and the package does NOT get installed:
Could not install package 'System.ServiceModel 1.0.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile7', 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.
I also tried profile 78 without luck (I removed Windows Phone 8.1 as explained here since there is no WCF support).
I tried different profiles for the PCL project as explained here, but without success.
Also, I tried using the Package Management Console and got similar error:
PM> Install-Package -Verbose
cmdlet Install-Package at command pipeline position 1
Supply values for the following parameters:
Id: System.ServiceModel
GET ... OK
Attempting to gather dependency information for package 'System.ServiceModel.1.0.0' with respect to project 'Mobile\MobileCashRegister', targeting '.NETPortable,Version=v4.5,Profile=Profile7'
Attempting to resolve dependencies for package 'System.ServiceModel.1.0.0' with DependencyBehavior 'Lowest'
Resolving actions to install package 'System.ServiceModel.1.0.0'
Resolved actions to install package 'System.ServiceModel.1.0.0'
Install failed. Rolling back...
Package 'System.ServiceModel.1.0.0' does not exist in project 'MobileCashRegister'
Package 'System.ServiceModel.1.0.0' does not exist in folder 'C:\dev\DevCuddlUpSolution\packages'
Install-Package : Could not install package 'System.ServiceModel 1.0.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile7', 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 -Verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
How can I know which profile needs to be selected for the System.ServiceModel nuget package to be installed successfully?
Please note I am using Visual Studio 2015 Professional and the latest available Xamarin.
System.ServiceModel 1.0.0 does not contain any assemblies in any lib folders. It just seems to contain NuGet.exe so you will not be able to use it.
It is also not an official Microsoft NuGet package.

Why can't I install a NuGet package which has target framework profile of 136?

I am trying to install Humanizer (see also GitHub and NuGet Gallery pages) using the NuGet package manager inside Visual Studio 2010. The documentation suggests it should support .NET 4+.
Issuing the following command on a brand new empty MVC4 project:
PM> install-package Humanizer
Gives me the following result:
Successfully installed 'Humanizer 1.26.1'.
Successfully uninstalled 'Humanizer 1.26.1'.
Install failed. Rolling back...
Install-Package : Could not install package 'Humanizer 1.26.1'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.0', but the package does not contain any assembly references that are compatible with that framework. For more information, contact the package author.
At line:1 char:16
+ install-package <<<< Humanizer
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
PM>
I contacted the author directly (and subsequently raised an issue on GitHub). He mentioned that the package targets Profile136 (can also be seen in the csproj file) which should support .NET 4:
<TargetFrameworkProfile>Profile136</TargetFrameworkProfile>
I had a look around and read this SO question which discusses building portable class libraries. Having read that, I discovered that Visual Studio 2010 requires an add-in to enable building of PCLs.
I realise I'm not building here, but I installed it anyway, along with the updated reference assemblies v4.6.
Having looked in the following folder:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.0\Profile
I discovered that I only have profiles up to 131, but no 136.
An answer to the SO question mentioned earlier suggests that 136 was added in the Windows Phone SDK 8.0. However I can't install this on Windows 7.
Why can't I install this package in Visual Studio 2010? Is it because I don't have profile 136 on my machine, or is that only required for building PCLs?
Note that I have installed other NuGet packages successfully, e.g. log4net.
You should not need to have the Portable Class Libraries installed to add the Humanizer NuGet package to a project that targets .NET 4.0.
The Profile 136 is in the Portable v4.6 reference assemblies. To install this you need to unzip the zip file that the installer installs. However you should not need to have any PCLs installed.
As a test I renamed the .NETPortable library directory so NuGet did not detect the portable libraries. Then with an empty ASP.NET MVC 4 project I could add a reference to Humanizer in Visual Studio 2010.
If you have a recent version of NuGet installed then it should work.

How can I install an old version of a ReSharper plugin?

I'm using ReSharper 8.0 in Visual Studio 2010. ReSharper 8.0 uses a NuGet-based Extension Manager for plugin management, which makes it very easy to find and install plugins, but this Extension Manager will only offer up the latest version of any given plugin. It also keeps track of plugin updates, and offers to update plugins when a new version is available.
This is where my problem has arisen. A particular plugin I use (GoToWord) has been updated, and the latest version (0.9.3) appears not to work. I cannot work out any way to roll back to the previous good version (0.9.1.1), nor a way to install an older version once I've uninstalled it.
I've tried opening the regular NuGet package manager console (at Tools | Library Package Manager | Package Manager Console) and issuing this command:
Install-Package resharper.GoToWord -version 0.9.1.1
But this fails at the dependency resolution phase, presumably because ReSharper isn't known to the regular NuGet:
Attempting to resolve dependency 'ReSharper (≥ 8.0)'.
Install-Package : Unable to resolve dependency 'ReSharper (≥ 8.0)'.
At line:1 char:16
+ Install-Package <<<< resharper.GoToWord -version 0.9.1.1
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
Does the ReSharper Extension Manager version of NuGet have a console? Or is there some other way to install an old version of a plugin?
Sadly, we didn't implement support for installing older versions of a plugin. But you should be able fake it manually, by editing the packages.config file in the %APPDATA%\JetBrains\ReSharper\vAny folder and adding a line such as:
<package id="ReSharper.GoToWord" version="0.9.1.1" />
If you restart VS now, and go to the extension manager, you should get prompted that some extensions aren't installed, and clicking the package restore button should download and install the right version.
Have you reported the issue on the project's GitHub page? https://github.com/controlflow/resharper-gotoword/issues

Resources