Could not install package 'Google.Apis.Core 1.13.1', Unable to uninstall 'Microsoft.Bcl.Build 1.0.21' - .net-4.0

I have problem with Google Calendar Api. Can't install Package Google.Apis, and Google.Apis.Auth, when Install-Package Google.Apis.Calendar.v3 works. Project in .net 4.0.
Install-Package : Unable to uninstall 'Microsoft.Bcl.Build 1.0.21' because 'Microsoft.Bcl 1.1.10' depends on it.
At line:1 char:1
+ Install-Package Google.Apis
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
Install-Package : Could not install package 'Google.Apis.Core 1.13.1'. You are trying to install this package into a projec
t 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.
At line:1 char:1
+ Install-Package Google.Apis.Auth
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
PM> Install-Package Google.Apis.Calendar.v3
'Google.Apis.Calendar.v3 1.13.1.509' already installed.
The primary reference "Google.Apis.Calendar.v3, Version=1.13.1.509, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Net.Http, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0". To resolve this problem, either remove the reference "Google.Apis.Calendar.v3, Version=1.13.1.509, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Net.Http, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".

Upgrade your project to .Net framework 4.5 and it should work. The error message tells you exactly what the problem is.
Could not install package 'Google.Apis.Core 1.13.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 or content files that are compatible with that
framework.
If you check the NuGet page Google APIs Core Client Library 1.13.1
The Google APIs Core Library contains the Google APIs HTTP layer, JSON
support, Data-store, logging and so on.
Supported Platforms:
.NET Framework 4.5
Windows Store apps
Windows Phone 8 and 8.1
Portable Class Libraries
You will have to go back to 1.10 to find a version that supports Framework 4.0
Home of the Google .Net Client library on GitHub

Related

[Azure Function]Could not load file or assembly 'System.Configuration.ConfigurationManager'

.Net Core 3.1. I used System.Runtime.Caching library, it depends on System.Configuration.ConfigurationManager.
But there is a amazing thing happened, I test it in MS unit test project[.NET Core 3.1], it runs well, then in Azure Function project[.NET Core 3.1], it will throw 'Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.' error, and in project .deps.json, also have dependency configurations
Below is Stack Trace:
System.Configuration.ConfigurationManager 6.0 won't support .net SDK 3.1, so update the "System.Configuration.ConfigurationManager" version to 4.7.0 and any other lower version. and try it.
According to your description, it seems it missed the nugetpackage System.Configuration.ConfigurationManager inside your application.
I suggest you could install the package System.Configuration.ConfigurationManager inside the local and re-publish again.
Install-Package System.Configuration.ConfigurationManager

How to create Cross Platform .net core library?

How do i create C# library in .Net core that can be shared between classic .Net 4.6.2 and .Net core projects using Nuget packages. I read the documentation here about developing cross platform libraries. So i setup my project.json as below
{
"version": "1.0.0-*",
"frameworks": {
"netstandard1.6": {
"dependencies": {
"NETStandard.Library": "1.6.0"
}
},
"net462": {
}
}
}
Then i created nugect pckage by executing the following command
dotnet pack -c Release
and then published the nuget package. My package name is DTO.
In my traget .net core project i was able to install nuget package without any issue. However when i try to install package in classic .net 4.6.2 project i get error
install-Package : Could not install package 'DTO 1.0.0'. You are
trying to install this package into a project that targets
'.NETFramework,Version=v4.6.2', 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 DTO + ~~~~~~~~~~~~~~~~~~~ + CategoryInfo :
NotSpecified: (:) [Install-Package], Exception + FullyQualifiedErrorId
:
NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Note that the nuget package is hosted on my local server.
You took the right direction. If you want compatibility across multiple frameworks, targeting .NET Standard is the right move.
However, you should refer to this matrix for the .NET Standard versions supported by each framework.
https://github.com/dotnet/corefx/blob/master/Documentation/architecture/net-platform-standard.md#mapping-the-net-platform-standard-to-platforms
According to this table, .NET Framework 4.6.2 supports .NET Standard 1.5 (not 1.6 as you specified). So here is your answer.
For more details about the assemblies supported in .NET Standard 1.5, please follow this link:
https://github.com/dotnet/corefx/blob/master/Documentation/architecture/net-platform-standard.md#list-of-net-corefx-apis-and-their-associated-net-platform-standard-version

Unable to install StructureMap.MVC4 on .NET 4, MVC 4, VS 2012

I am trying to install StructureMap.MVC4 for a project, created in Visual Studio 2012, .NET 4.0 and ASP.MVC 4.
But I am getting below error:
Could not install package 'Microsoft.AspNet.WebApi.Client 5.1.2'. 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.
At line:1 char:16
+ install-package <<<< structuremap.mvc4 WebApi_StructureMap_DotNet4
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
Any suggestions on what I am missing please!
Microsoft.AspNet.WebApi.Client 5.1.2 can only be installed into a project that targets .NET 4.5 or is a portable class library. It does not have any assemblies for .NET 4.0.
The latest version of StructureMap 3.0 depends on Microsoft.AspNet.WebApi.Client 5.1.2 so if you want to that the latest version of StructureMap 3.0 you would need to change your project so it targets .NET 4.5.
Older versions of StructureMap.MVC4 may work with .NET 4.0. Version 2.6.4.3 for example depends on an older version of Microsoft.AspNet.WebApi which supports .NET 4.0. Even older versions of StructureMap.MVC4, such as 2.2.0 do not depend on Microsoft.AspNet.WebApi.

Can't get NLog 2.0.1 version from NUGet

In Visual Studio 2010, in Package Manager Console I type:
Install-Package NLog -Version 2.0.1
And I'm getting 2.0.0 (on disk). On Codeplex there's no 2.0.1 version. Version 2.0.1 is required for ServiceStack.Logging.NLog because of error:
Can't load file 'NLog, Version=2.0.1.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c' or one of it dependencies. (Exception HRESULT: 0x80131040)
Version 2.0.1 is also listed on NuGet available packages.
I have replaced NLog.dll and ServiceStack.Logging.NLog.dll with files from latest ServiceStack v3 snapshot and my program runs fine (ASP .Net4 Web Application) but this is not solution for long time. In ServiceStack snapshot NLog.dll is 2.0.0 and ServiceStack.Logging.NLog.dll is 1.0.8.
Try NLog version 2.0.1.1 or 2.0.1.2 from NuGet.
The NLog assembly in those packages has a version of 2.0.1.0

entity framework 5 install on win8 MSVC2012 RTM

I have recently installed the Latest Win8 OS (RTM) and installed MSVC 2012 RTM as well (I also have MSVC 2010 installed as I am porting from Win7 Phone to Win 8 Tablet and need to refer to the old code (not sure if this may affect outcome)). I need to install Entity Framework in MSVC 2012 and when I look at the NuGet Package Manager it tells me version 5.0.0. is available. However it never installs correctly, it says it has installed successfully then, says it can't and uninstalls it. I have tried using the NuGet Package Manager and the PM console, the results from the PM console are below :
PM> Install-Package EntityFramework
You are downloading EntityFramework from Microsoft, the license agreement to which is available at http://go.microsoft.com/fwlink/?LinkId=253898&clcid=0x409. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.
Successfully installed 'EntityFramework 5.0.0'.
Successfully uninstalled 'EntityFramework 5.0.0'.
Install failed. Rolling back...
Install-Package : Could not install package 'EntityFramework 5.0.0'. You are trying to install this package into a project that targets '.NETCore,Version=v4.5', 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:1
+ Install-Package EntityFramework
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
When I look at the packages folder during the install it all seems present and then it is deleted. I have admin rights set on my user Account.
What is going wrong? pls help.
Brenda
You are adding EntityFramework package to Windows 8 Application or class library project (= to Metro application). That is not supported. You must use full .NET Framework 4.5 (= desktop application, web application, etc.) to use Entity Framework.
I had this problem. This is what I did:
From the package manager console:
PM> Uninstall-Package EntityFramework -Force
This threw an error. I then went to the "packages" folder under the solution folder and removed the Entity Framework subfolder. I then ran
PM> Install-Package EntityFramework
And then right-clicked my project where I wanted to install EF and installed it from the NuGet dialog.