Unable to install StructureMap.MVC4 on .NET 4, MVC 4, VS 2012 - asp.net-mvc-4

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.

Related

Can't install the Xero.NetStandard.OAuth2

I cannot install the Xero.NetStandard.OAuth2 Nuget package from either VS2017 or VS2019. The error is:
Could not install package 'Xero.NetStandard.OAuth2 3.16.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6', 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.
While my web app is .NET Framework version 4.6.
The Xero NetStandard SDK targets .NET Standard 2.0 and is only compatible with .NET Framework > 4.6.1.
You can see all the compatible frameworks for .NET Standard 2.0 here:
.NET implementation support

'MySql.Data' already has a dependency defined for 'System.Text.Encoding.CodePages' [duplicate]

I'm trying to add AutoMapper as a dependency to a project using NuGet on Visual Studio Premium 2012, but it fails.
It says:
Operation failed
'AutoMapper' already has a dependency defined for
'Microsoft.CSharp'.
I'm able to add other dependencies.
I'm using the last version of the package manager for VS 2012:
NuGet Package Manager 2.8.60318.667
Any ideas what should I check?
The problem is that your NuGet Package Manager is too old. You need NuGet 2.12 since this supports the newer .NETStandard frameworks that the AutoMapper 5.0.1 NuGet package is using.
The AutoMapper has a group dependency which specifies a target framework of .NETStandard. Since your version of NuGet Package Manager is too old it does not recognise this target framework and converts it to an Unknown target framework and you end up with duplicate frameworks since there .NETStandard is used a few times in that NuGet package. This causes the error:
'AutoMapper' already has a dependency defined for 'Microsoft.CSharp'
Unfortunately NuGet 2.12 is not available for Visual Studio 2012 but is available for Visual Studio 2013.
So either you need to update to Visual Studio 2013 or above, or you will have to use the older AutoMapper NuGet package which does not support .NETStandard.
Seems to be a problem with the current version of automapper:
AutoMapper 5.0.0 Tuesday, June 28, 2016
I tried with the previous version and it works:
PM> Install-Package AutoMapper -Verbose
Install-Package : 'AutoMapper' already has a dependency defined for 'Microsoft.CSharp'.
At line:1 char:16
+ Install-Package <<<< AutoMapper -Verbose
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
PM> Install-Package AutoMapper -Version 4.2.1
Installing 'AutoMapper 4.2.1'.
Successfully installed 'AutoMapper 4.2.1'.
So, if you can't update NuGet Package Manager, the answer is:
PM> Install-Package AutoMapper -Version 4.2.1
I ended up needing to update NuGet.exe that was included in the solution to be able to build NuGet packages by running:
nuget.exe update -self
I had the same issue on VS2013. I had to update to VS2013 Update 5 and get the latest nuget distro for VS2013 at
https://dist.nuget.org/visualstudio-2013-vsix/v2.12.0/NuGet.Tools.vsix
Once that was done, I rebooted Visual Studio. After that I was able to use the Automapper 5.0.2 package
Go to Visual Studio > Tools > Extension and Updates
Find Updates in left accordion menu, Go to Visual Studio Gallery.
You will find a update for Nuget.
Update the nuget package and try installing or builing the project.
Thanks,
GT
An other workaround if you're stuck with VS2012 and the old Nuget version:
Find the Cache folder of VS 2012's Nuget Package Manager (with Tools - Options - Nuget Package Manager)
Open AutoMapper.5.x.x.nupkg with your favorite Zip Tool
Modify the file AutoMapper.nuspec - I simply deleted all dependencies except .NETFramework4.5
Add the cache folder as a Nuget source (also in Tools - Options - Nuget Package Manager)
Install Automapper either with the console or the GUI but make sure to choose first the newly added cache folder as package source.
Of course, the next version of Automapper probably needs to be adapted, too, in order to install it.
This looks like a mismatch between the .NET version used by the Automapper package and your project. Can you confirm the .NET version that your project is using?
Automapper 6.0.2 - nuget 2.8.8 gives this error. Needed to update to 3.4.4 to get this working.
Removed both CSharp and AutoMapper. Installed CSharp (4.0.0.0) first and then added Automapper (6.1.1.0). This resolved the problem for me.
I observed this exact problem when opening a project with Visual Studio 2010.
After opening with VS2017, I was able to install AutoMapper without any error.

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

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

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

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.