How to create .netstandard nuget package? - c#

I'm trying to create nuget package using my .netstandard 1.2 dll.
I can't install this nuget in UWP project because of error:
Package ZZZ is not compatible with uap10.0.14393
(UAP,Version=v10.0.14393). Package ZZZ 1.0.0 supports: net
(.NETFramework,Version=v0.0)
What and where should be configured to add support for example for UWP?
When I reference my .netstandard dll in UWP project directly, everything works fine.

How are you creating the nuget package?
Try upgrade to the latest nuget.exe and pack with that
Alternativly use the built in packing that is part of dotnet core csproj file and visual studio 2017/msbuild (and dotnet pack) by creating a brand new netstandard project and adding nuget properties in the csproj file
Check the version compatability of UWP and netstandard and consider changing to netstandard 2 and UWP 10.0.16299 as lots of these gremlins have been resolved

Related

Could not install package 'Microsoft.Owin 4.0.0'. Am I not able to install Microsoft.Owin packages into a .NETFramework project?

So I am working with .NETFramework,Version=v4.5 and I need to use Microsoft.Owin.Security.Google as well as Microsoft.Owin.Host.SystemWeb. However I'm getting the following error when trying to install said NuGet packages:
Could not install package 'Microsoft.Owin 4.0.0'. 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.
Is there another way to use Microsoft.Owin NuGet packages in a .NETFramework project?
Change your Framework version to v4.5.1 or later:

How do I Build or Run .Net Core2 Projects

I have tried creating asp project using either dotnet cli or visual studio 2017, any time i try to run the project in both cases, i get this strange error.
this how how i created a sample angular project. dotnet new angular in a folder
called angular
Angular.csproj: [NU1202] Package
Microsoft.Extensions.DependencyInjection.Abstractions 2.0.0 is not
compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package
Microsoft.Extensions.DependencyInjection.Abstractions 2.0.0 supports:
netstandard2.0 (.NETStandard,Version=v2.0)
Seems like this may have been a bug with this specific version of Dot Net core, I found this thread:
https://rider-support.jetbrains.com/hc/en-us/community/posts/115000759144-Compile-Microsoft-CSharp-Core-targets-84-5-MSB6004-C-Program-Files-dotnet-sdk-2-1-2-Roslyn-RunCsc-cmd-
Which suggests copying the RunCsc.cmd from C:\Program Files\dotnet\sdk\2.1.4\Roslyn\bincore to C:\Program Files\dotnet\sdk\2.1.4\Roslyn
I would suggest to check the installation of your dot net core, this seems very weird.
Hope this helps
finally this is what worked for me
dotnet nuget locals all --clear

Microsoft.Rest.ClientRuntime can not be installed in Xamarin PCL Project

I tried to add Microsoft.Rest.ClientRuntime v2.3.10 via Nuget to a standard Xamarin PCL project and got following error:
Could not install package 'Microsoft.Rest.ClientRuntime 2.3.10'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile111', but the package does not contain any assembly references or content files that are compatible with that framework.
The targets for the project as as follows:
Solution was just to install version 2.0.0 of Microsoft.Rest.ClientRuntime, which is portable.

System.Reactive/Rx .NET 4.0 on Nuget

I am trying to add System.Reactive.Core to a .NET 4.0 project using VS2013 and getting the following error:
Could not install package `System.Reactive.Core 3.0.0`.
You are trying to install this package into a project that target
`.NETFramework,Version=v4.0`, but the package does not contain any assembly
reference or content files that are compatible with that framework.
I also cannot find the old Rx-Main packages anymore on nuget.org.
How can I get Rx Installed on .NET 4.0?
I guess I will have to manually go find the RxMain 2.x libs and reference them directly from a lib folder in my solution?
Ok I figured it out, Rx-Main has been unlisted, therefore can only install it using the following command:
Install-Package Rx-Main -Version 2.2.5
To Rx Team: You should of recreated 2.2.5 System.Reactive which allowed us to target .NET 4.0 before moving up to 3.0.0.

How to make a NuGet package for this PCL library

I'm trying to create a nuget package for a PCL library I've made.
This nuget package is intended to be used in a Xamarin Forms application though. So I'm not even sure if the things I've ticked are correct.
I really only care about .NET Framework 4. That is my bare minimum framework. For the rest, I don't care at all and have no idea what I should be targetting.
For what it's worth, I'm using NuGet Package Explorer to create my NuGet nupkg files to manually test them before I publish them to NuGet.
Here's a screenshot of what I was trying, but Xamarin Studio failed to add the nuget package (saying it wasn't the right something-or-rather).
and the error message from Xam Studio:
Adding Foo...
Adding 'Foo 1.3.0' to Core.
Could not install package 'Foo 1.3.0'. You are trying to install this package into a project that targets 'portable-net45+win+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10', 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.
For Xamarin.Forms the two profiles that are good ones for your Portable Class Library (PCL) project to use are Profile 78 or Profile 259. Xamarin.Forms can be used in other profiles but if your PCL project targets one of these you should be OK. Your project looks to be targeting Profile 78.
Here are the Xamarin.Forms PCL profiles for reference.
Xamarin.Forms 1.3:
portable-win+net45+wp80+MonoAndroid10+MonoTouch10
Xamarin.Forms 1.4:
portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10
The problem with your NuGet package that it does not indicate that it supports Windows 8 in the PCL. NuGet will look at all the individual frameworks that make up the project's PCL profile (ignoring the Xamarin and Mono ones since they are optional if you do not have them in your NuGet package's PCL profile) and ensure that the NuGet package's PCL profile has a framework which is compatible. If the NuGet PCL does not have a matching framework then NuGet considers it incompatible.
So your NuGet package's portable library folder would need to include win
portable-net4+sl5+wp8+win
Then you can install your NuGet package into your Profile 78 PCL project.

Categories

Resources