This should be a simple question but I can't seem to find the answer anywhere.
I've got a project that I'm building to .Net 3.5. I'm trying to include Newtonsoft JSON.Net as a reference, but NuGet is installing a version built to .Net 4.0. This makes it impossible for me to use my compiled assembly in an environment that does not support .Net 4.0.
Is there any way to configure NuGet so that it ensures that the reference is not built to a version of .Net beyond the project settings?
Maybe you can use this answer to a similar question:
Download old version of package with nuget
It says that you can install an old version of a package
You can try to install a version compatible with .NET Framework 3.5, and it will be solved!
;) I hope this helps
NuGet will use the project's target framework to pick the correct assembly from the NuGet package. You cannot override this behaviour.
The latest version of the Json.NET NuGet package (6.0.1) contains an assembly specifically for .NET 3.5 so NuGet should automatically pick that one if your project has a target framework of 3.5.
Changing my project's target framework to 3.5 results in the following element being added to the project:
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
This is what NuGet uses to determine which assembly to use.
When Json.NET is installed into this project the Newtonsoft.Json.dll file is referenced from the packages\Newtonsoft.Json.6.0.1\lib\net35 directory. That assembly targets .NET 3.5
Related
Following this I created a console .Net Core 2.1 application, and I'm using Microsoft.Azure.WebJobs.Core NuGet v. 3.0.0-beta5. For some reason the project can't compile as it says it cannot find the assemblies. Why on earth?
Actually, you do not need to install Microsoft.Azure.WebJobs.Core NuGet v. 3.0.0-beta5.
You could just try to install Microsoft.Azure.WebJobs version 3.0.0-beta5. Then it will work.
This Microsoft.Azure.WebJobs package contains the runtime assemblies for Microsoft.Azure.WebJobs.Host. It also adds rich diagnostics capabilities which makes it easier to monitor the WebJobs in the dashboard. For more details, you could refer to this article.
I am working on a PCL project that is using Profile44 as TargetFrameworkProfile. When I try to install NodaTime 2.2.4 I get the following error message:
Could not install package 'NodaTime 2.2.4'. 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.
Do I have to downgrade to .Net 4.5 or what options do I have?
Noda Time 2.x only supports the Target Framework Monikers netstandard1.3 and net45. There's no direct PCL support, although some environments that traditionally used PCLs now support .NET Standard.
The 1.x series supports PCLs via Profile328, which has a NuGet target of "portable-net4+sl50+win8+wpa81+wp8". For environments that don't yet support .NET Standard, trying the 1.x series is the best option.
Note that I'm expecting Noda Time 3.0 to probably target netstandard2.0, although I'll still keep the older versions up to date with respect to time zone data.
I am trying to update one of my Xamarin.Forms apps that uses the deprecated Microsoft.WindowsAzure.Mobile.SQLStore pacakge with the new Microsoft.Azure.Mobile.Client.SQLiteStore package but I get the following error when I try to install the package in my Core pcl project:
Could not install package 'Microsoft.Azure.Mobile.Client.SQLiteStore 4.0.0'.
You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile78', 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 tried to follow this documentation but they seem to forget to add the code sample, so I can't figure out exacly what they are doing. The deprecated Microsoft.WindowsAzure.Mobile.SQLStore package installed in a PCL library but the new Microsoft.Azure.Mobile.Client.SQLiteStore package doesn't or so it seems.
Any help would be appreciated.
It turns out that Microsoft.Azure.Mobile.Client.SQLiteStore 4.0.0 does not support PCL anymore but they moved to .NET Standard 1.4. PCL support stops at version 3.1.0
So if you are using PCL install v3.1.0. But before you install v3.1.0, make sure you manually remove the deprecated Microsoft.WindowsAzure.Mobile.SQLStore first.
Check out this issue for more details: https://github.com/Azure/azure-mobile-apps-net-client/issues/337
you can try and open the .csproj of your PCL and replace the Profile78 entry with a profile the NuGet package supports (probably Profile259 which includes almost everything but windows phone silverlight)
If your project won't compile after changing your profile (because there are missing type references e.g.) try picking a different profile the package supports.
If you're having multiple PCLs you might need to change the target profile of all of them.
Try Changing .Net profile to Profile 7 and then update.
Go To Cross Platforms Project Options->Build->General->.Net Portable
I just updated the Microsoft.Azure.Mobile.Client package in my Xamarin project and now the System.Net.Http namespace doesn't exist anymore. Here's the error message. I was using the MobileServiceClient object to pass through the URL for my Azure backend. What should I do now? I don't want to go back to the previous version if I don't have to.
The error message is pretty explicit. Do you have a System.Net.Http reference in your app? If not, add one.
What is likely to have happened is that the dependency that the package has is for a version of System.Net.Http that is not compatible with your target .net version and the upgrade has removed the old version and not been able to add the new version.
You will need to find the version of System.Net.Http which is a dependency of Microsoft.Azure.Mobile.Client and find out what version of .Net it targets (the folder is likely to be underneath your packages folder even if the reference is missing).
Then you can decide whether you can target your project at a newer version of .Net or whether you need to downgrade Microsoft.Azure.Mobile.Client.
I have added Catel.Core 3.7, Catel.MVVM 3.7 and Catel.Extensions.Controls 3.7 to my Project but does not have the codesnippets. I have looked in C:\Users\NNUser\Documents\Visual Studio 2013\Code Snippets\Visual C#\My Code Snippets and no Catel folder there. I can neither find any templates.
I got the impression these should be automatically installed, or do I need to install them manually as indicated in the end of this thread. Seems to be available here but are those version independent?
NuGet isn't the right mechanism to deploy code snippets & templates. It only contains the actual binaries when deployed via NuGet.
They should be installed manually as documented here
The code snippets and templates are mostly version independent, but will always work with the latest version.
btw. why are you using v3.7? The latest version is 3.9 and 4.0 is about to be released