Why NuGet is it getting MVVMLight for all frameworks and all platforms? - mvvm-light

NuGet is getting MVVMLight binaries for WPF, SL3, SL4, SL5, WP7
I don't really like that.
Is there a way to make it get just for the framework which the project is using?
How is generally NuGet working for other packages, it maybe something which the MVVMLight author should do when creating the NuGet package?
Thanks,
Andrew

It's a nuget convention to include libraries of different framework versions inside a unique package. This makes it easier for the package consumer, there's only one version of a package to install.
When installing a package through NuGet Package Manager (UI or console), NuGet will only add references to libraries that targets your project's framework. Note: all the package content is unpacked to "\packages\", including libraries that aren't used.
Example:
I created a SL4 application and installed MVVMLightLibs. Only GalaSoft.MvvmLight.Extras.SL4 and GalaSoft.MvvmLight.SL4 are added as a reference.
see nuget documentation : Supporting_Multiple_.NET_Framework_Versions_and_Profiles

Related

Using SQLite with Xamarin.Forms cross-platform project

I have used Visual Studio 2017 Community edition to create a plain vanilla cross platform PCL project, and would like to use SQLite. The only thing done to the project(s) was the use of Nuget to update all packages that needed updating.
Then, following the instructions on the Xamarin website at
https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/databases/
I used Nuget to install sqlite-net-pcl,
It all seemed to work OK, except at the end the following error appears.
I presume the documentation is slightly dated. Should I change the target .NET framework. If so, to what?
As of v1.3 SQLite-Net-PCL is actually no longer a PCL, it is a .Net standard library.
You need to install version 1.2.0 of the NuGet package to use it inside a PCL - from the nuget package manager you can select a version so install v1.2.0 into all your projects.
The library above worked OK as a PCL library, but what I disliked was that the platforms were split out in to separate DLLs so you had a different dependency for each platform.
This library is for .NET Standard and only has a single DLL for all platforms:
https://github.com/MelbourneDeveloper/SQLite.Net.Standard
It does not support the ORM like functionality in the above library though.

How to find out if a nuget Package is usable in .NET Core

If i search a nuget package within visual studio or at https://www.nuget.org/, how do i see if the nuget package is usable in .net core?
As far as I know, there is currently no possibility to search directly for nuget packages which can be used in .net core (Source). But can i check it for a specific one?
Currently there is no way to search for packages by target-framework.
You can follow this issue on Github for news/more information

Error installing System.IdentityModel.Token.Jwt in Xamarin.Forms

I'm trying to use the System.IdentityModel.Token.Jwt NuGet package for my Xamarin.Forms app. When I try to add the package to my PCL, it installs in my Android and iOS projects, but I get the following error when adding it to the shared code project:
Could not install package 'System.IdentityModel.Tokens.Jwt 5.1.3'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.6,Profile=Profile44', 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.
Does anyone know how to get around this? I think it has to do with what my project targets but I've tried a few combinations and all of them have produced the same error, just with a different profile listed.
Unfortunately the System.IdentityModel.Tokens.Jwt 5.1.3 NuGet package only contains assemblies that support:
.NET Framework 4.5.1
.NET Standard 1.4
No portable class library profile supports .NET Standard 1.4. The highest they support is .NET Standard 1.2.
So unless you can find another NuGet package that does support portable class libraries you are left with trying to compile the Jwt source code for the portable class library profile you need, or converting your portable class library project into a .NET Standard project and target at least 1.4. You should be able to convert your portable class library project into a .NET Standard project in the project options.

Which NuGet package contains System.Web.Optimization?

I'd like to handle my web application references using NuGet. Which NuGet package contains System.Web.Optimization?
I've searched the NuGet website. I've also looked at Which NuGet package contains System.Web.Routing?, and it answers a different question.
The NuGet Package that contains System.Web.Optimization is called Microsoft ASP.NET Web Optimization Framework.
Install-Package Microsoft.AspNet.Web.Optimization

How to Install MVVMLight in Xamarin Studio Xamarin.Forms PCL

I think this is related to this -
Cannot install MvvmLight for Windows Phone 8.1 app project
Trying to install libs only nuget. Seen a PCL version mentioned somewhere but its not in the Nuget list.
Could not install package 'MvvmLightLibs 4.4.32.1'. You are trying to
install this package into a project that targets
'portable-net45+win+MonoAndroid10+MonoTouch10', 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.
When I try to install in Xamarin Studio.
Can I assume that I need the latest version of NuGet and the version 2.8.1 is not new enough in XS?
Does MVVMLight support Xamarin Studio? Does anyone know a workaround, I am currently on Indie license and would love to progress with this on a Forms based prototype.
Looking at the MvvmLightLibs 4.4.32.1 NuGet package it does not have any Portable Class Libraries (PCLs) so you will not be able to install it into a PCL project.
Take a look at the Portable.MvvmLightLibs NuGet package instead. That package has a PCL assembly and you should be able to install it into the Xamarin.Forms PCL project.

Resources