NuGet can't update packages - asp.net

Could not install package 'Microsoft.AspNetCore.Http.Abstractions
2.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.7', 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.
There are 3 packages I cannot update because of this error:
Microsoft.AspNetCore.Http.Abstractions (Attempting to go from 1.1.2 to 2.0.0)
Microsoft.AspNetCore.Http.Features (Attempting to go from 1.1.2 to 2.0.0)
Microsoft.Extensions.Primiatives (Attempting to go from 1.1.1 to 2.0.0)
Can I simply not use these packages if I'm on .net 4.7?

Related

Building package against older Rcpp version

I'm writing an R package for simulations using Rcpp. Rcpp project setup has added my Rcpp version as dependendy Rcpp (>= 1.0.9)
A project partner who is trying to run the simulations has Rcpp version 1.0.8. I did not see anything in the release notes of Rcpp 1.0.9 that would suggest, that the package wouldn't build on version 1.0.8 but I would want to try to build it before changing the dependency.
Would the following work to test this:
install Rcpp 1.0.8 from the CRAN archive to a local library
add the local library as first entry to library paths with .libPaths
call devtools::build

Unable to installl Xamarin.Azure.NotificationHub.Android nuget to existing project

I got the following error when I was trying to install Xamarin.Azure.NotificationHub.Android nuget package to my existing xamarin.forms project.
One or more unresolved package dependency constraints detected in the existing packages.config file. All dependency constraints must be resolved to add or update packages. If these packages are being updated this message may be ignored, if not the following error(s) may be blocking the current package operation: 'Xamarin.Forms 4.5.0.617 constraint: Xamarin.AndroidX.Lifecycle.LiveData (>= 2.1.0)', 'Xamarin.Forms 4.5.0.617 constraint: Xamarin.Google.Android.Material (>= 1.0.0)', 'Xamarin.Forms 4.5.0.617 constraint: Xamarin.AndroidX.Legacy.Support.V4 (>= 1.0.0)', 'Xamarin.Forms 4.5.0.617 constraint: Xamarin.AndroidX.Browser (>= 1.0.0)'
Unable to find a version of 'Xamarin.Android.Arch.Core.Common' that is compatible with 'Xamarin.Android.Arch.Core.Runtime 1.1.1.3 constraint: Xamarin.Android.Arch.Core.Common (= 1.1.1.3)', 'Xamarin.Android.Arch.Lifecycle.LiveData 1.1.1.3 constraint: Xamarin.Android.Arch.Core.Common (= 1.1.1.3)', 'Xamarin.Android.Arch.Lifecycle.LiveData.Core 1.1.1.3 constraint: Xamarin.Android.Arch.Core.Common (= 1.1.1.3)'.
But my project already has Xamarin.Android.Arch.*** 1.1.1.3 installed.
I had no issue when installing Xamarin.Azure.NotificationHub.Android nuget to a fresh project. The error occurs when installing to one my existing Xamarin.Forms project which already uses AppCenter.
Is this because of some package dependency conflict? If so, how to resolve it?
Xamarin.Azure.NotificationHub.Android (1.1.1) package uses Xamarin.GooglePlayServices.Base (>= 70.x.x) and Xamarin.Firebase.Messaging (>= 70.x.x) as dependencies. One of the packages installed on the project also depends on Xamarin.GooglePlayServices.Base package. Xamarin.Azure.NotificationHub.Android (1.1.1) package needs a higher version of GooglePlayservices.Base (>= 70.x.x)package. Since my project uses a package.config file to manage installed packages, the existing package already installed a lower version of GooglePlayservices.Base package (60.x.x).
I was able to resolve this issue in 2 ways:
Uninstall the package which creates the conflict with all its dependencies. Then reinstall the package with setting Dependency Behavior as Lowest. Then I was able to install NotificationHub.Android package without any errors.
Migrate from package.config to new PackageReference format. In this way, it's easier to see what are the packages directly installed on the project and don't have to worry about dependencies. This also shows which packages create the conflict. Fixed the issue as the error log suggested.
NU1107: Version conflict detected for Xamarin.GooglePlayServices.Basement. Install/reference Xamarin.GooglePlayServices.Basement 71.1620.4 directly to project XXX to resolve this issue.
XXX -> Xamarin.Azure.NotificationHubs.Android 1.1.1 -> Xamarin.Firebase.Messaging 71.1740.4 -> Xamarin.GooglePlayServices.Basement (>= 71.1620.4)

AddIdentity .NET Core

I'm trying to install the Nuget Package to use Microsoft.AspNet.Identity.Core 2.2.1 but I get the following error message.
Package Microsoft.AspNet.Identity.Core 2.2.1 is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1). Package Microsoft.AspNet.Identity.Core 2.2.1 supports: net45 (.NETFramework,Version=v4.5)
One or more packages are incompatible with .NETCoreApp,Version=v1.1.
Package restore failed. Rolling back package changes for 'xxxx'.
I created a brand new project in Visual Stuido 2017 so is nothing to do with anything else I have installed.
The string (.NETFramework,Version=v4.5) is the clue. It means the package cannot be used with ASP.NET Core. It is a sure sign you have the wrong package.
Just because the package name contains the word 'core' doesn't mean it works with ASP.NET core. This explained by Pierre-Loup Pagniez in his answer What is the difference between Microsoft.Aspnet.identity.Core vs Microsoft.AspNetCore.Identity

azure continuous deployment fail

ll of the sudden, Azure continuous deployment constantly fails. Can't get the reason. Here is deployment log, where fail happens.
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling ASP.NET Core Web Application deployment.
Restoring packages for D:\home\site\repository\project.json...
CACHE https://api.nuget.org/v3-flatcontainer/microsoft.netcore.platforms/index.json
WARNING: Detected package downgrade: System.Xml.XmlSerializer from 4.0.10-beta-23109 to 4.0.0-beta-23109
repository (>= 1.0.0) -> WindowsAzure.Storage (>= 6.2.2-preview) -> System.Runtime.Serialization.Xml (>= 4.0.10-beta-23109) -> System.Private.DataContractSerialization (>= 4.0.0-beta-23109) -> System.Xml.XmlSerializer (>= 4.0.10-beta-23109)
repository (>= 1.0.0) -> WindowsAzure.Storage (>= 6.2.2-preview) -> System.Xml.XmlSerializer (>= 4.0.0-beta-23109)
Package Microsoft.CodeAnalysis.CSharp 1.1.0-rc1-20151109-01 is not compatible with dnxcore50 (DNXCore,Version=v5.0). Package Microsoft.CodeAnalysis.CSharp 1.1.0-rc1-20151109-01 supports:
- net45 (.NETFramework,Version=v4.5)
- portable-net45+win8 (.NETPortable,Version=v0.0,Profile=Profile7)
Package Microsoft.Data.OData 5.6.4 is not compatible with dnxcore50 (DNXCore,Version=v5.0). Package Microsoft.Data.OData 5.6.4 supports:
- net40 (.NETFramework,Version=v4.0)
- portable-net40+sl5+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile328)
- portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259)
- sl4 (Silverlight,Version=v4.0)
Package Microsoft.Data.Services.Client 5.6.4 is not compatible with dnxcore50 (DNXCore,Version=v5.0). Package Microsoft.Data.Services.Client 5.6.4 supports:
- net40 (.NETFramework,Version=v4.0)
- portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259)
- sl4 (Silverlight,Version=v4.0)
Package System.Spatial 5.6.4 is not compatible with dnxcore50 (DNXCore,Version=v5.0). Package System.Spatial 5.6.4 supports:
Tried it with the newest version of the code, with previously successfully deployed versions, with new app, with new app and different app.
If I had to guess, I'd say they're using the new NuGet, which probably means you need to update your project.json file to add imports statements to add compatibility between PCLs and DNX.
To workaround this issue, you can specify a specific version of the System.Xml.XmlSerializer package that works with your project.
Here is a description of how to solve it specific to RC2. Not sure which version would be for RC1.
https://github.com/aspnet/Home/issues/1469#issuecomment-220251320

Could not install Microsoft.AspNet.Razor 3.0.0

I am working on an ASP.NET project in which I need to do simple HTML templating.
The prettiest solution seems to be RazorEngine, which depends on Microsoft.AspNet.Razor. However, when trying to install Microsoft.AspNet.Razor via Nuget, the following error message is shown:
Installing 'Microsoft.AspNet.Razor 3.0.0'. Successfully
installed 'Microsoft.AspNet.Razor 3.0.0'. Adding
'Microsoft.AspNet.Razor 3.0.0' to EBulkDBSManagementApp.
Uninstalling 'Microsoft.AspNet.Razor 3.0.0'. Successfully
uninstalled 'Microsoft.AspNet.Razor 3.0.0'. Install failed.
Rolling back... Could not install package
'Microsoft.AspNet.Razor 3.0.0'. 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 or content files that
are compatible with that framework. For more information, contact the
package author.
Any solution?
The latest RazorEngine 3.4.0 NuGet package depends on the Microsoft.AspNet.Razor 3.0.0 NuGet package which requires .Net 4.5
If you wish to use RazorEngine with a version of .NET prior to 4.5, then you will need to use the RazorEngine 3.3.0 NuGet pacakage.
You can install this using the package manager console with the following command.
Install-Package RazorEngine -Version 3.3.0

Resources