Error while installing Microsoft.AspNet.WebApi.OwinSelfHost from NuGet - asp.net

I'm trying to get this: http://www.asp.net/web-api/overview/hosting-aspnet-web-api/use-owin-to-self-host-web-api running.
Therefore I need to put this into NuGet package manager console
Install-Package Microsoft.AspNet.WebApi.OwinSelfHost
I got the following Error
Install-Package : Das angegebene Argument liegt außerhalb des gültigen Wertebereichs. (in english: The given argument is out of the valid value range.)
parametername: supportedFrameworks
at line:1 position:16
+ Install-Package <<<< Microsoft.AspNet.WebApi.OwinSelfHost
+ CategoryInfo : NotSpecified: (:) [Install-Package], ArgumentOutOfRangeException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
You can find this package's dependencies on https://www.nuget.org/packages/Microsoft.AspNet.WebApi.OwinSelfHost/5.2.3 .
I continued to locate where the error comes from and found that the Newtonsoft Json package could be the problem. But since there are no dependencies or subpackages given, I cannot go any further which let me post my question here:
What to do, to solve this problem?
My project's target framework is .NET 4.5.1 and I use VS2013 with recent update and NuGet manager V2.8 (also the recent version for VS2013, I think).
Edit1: I found that e.g. my Microsoft.CSharp reference is to Microsoft.CSharp V4.0.0.0 ... for recent Json versions Microsoft.CSharp V4.0.1 or higher is needed. How do I update this? And why do I have to do this?

Related

add-migration : Cannot bind argument to parameter 'Path' because it is null

I want to enable migration in visual studio 2017. When I run it, I'm getting an error. The error message is:
add-migration : Cannot bind argument to parameter 'Path' because it is
null. At line:1 char:1
+ add-migration ApplyAnnotationsToCustomerName
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Add-Migration], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Add-Migration.
I tried to uninstalling and reinstall EntityFramework and it didn't work.
Also my startup project is set to the project with EF.
nothing worked!!
Ohh... spent hours trying to figure this one out. I tried all the suggestions I could find and even tried what you did uninstalling and reinstalling EF. Nothing seemed to work and it was really frustrating. In the end what ultimately worked for me was how I uninstalled and reinstalled EF!
Uninstall:
PM> Uninstall-Package EntityFramework -Force
Reinstall EntityFramework:
PM> Install-Package EntityFramework -Pre
Source: https://entityframework.net/knowledge-base/14410987/entity-framework-code-first-migration-error

Xamrain Forms Maps not working as expected

I am trying to use the Xamrin forms map inteface to add custom pins acording to the doumenation here on microsoft but I am having an error it said that it should add the google play services automatically but it does not so I am trying to use the nuget.
Microsoft documentaiton
https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/map
Nuget for google play sevices
https://www.nuget.org/packages/Xamarin.GooglePlayServices.Maps/
But I also get the following error.
GET https://nuget.telerik.com/nuget/FindPackagesById()?id='Xamarin.GooglePlayServices.Maps'&semVerLevel=2.0.0
Install-Package : Failed to retrieve information about 'Xamarin.GooglePlayServices.Maps' from remote source
'https://nuget.telerik.com/nuget/FindPackagesById()?id='Xamarin.GooglePlayServices.Maps'&semVerLevel=2.0.0'.
An error occurred while sending the request.
Unable to connect to the remote server
An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full
At line:1 char:1
+ Install-Package Xamarin.GooglePlayServices.Maps -Version 71.1610.0
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Strange thing is this i have it set to nuget.org

EntityFramework Core database first, Scaffold-DbContext A positional parameter cannot be found that accepts argument '--use-database-names' error

I am trying to create the model from existing DB using EntityFramework Core, database first approach. The model was created, but the table name and column name were changed to C# style. Because I want the model still using exact table name and column name as in the database, so I append the "--use-database-names" in the command line, according to Entity Framework Core tools reference
Following is the command executed in the Package Manager Console:
Scaffold-DbContext "Server=aServer;Database=someDb;Trusted_Connection=True" Microsoft.EntityFrameworkCore.SqlServer -o Models --use-database-names
But I got following error:
Scaffold-DbContext : A positional parameter cannot be found that accepts argument '--use-database-names'.
At line:1 char:1
Scaffold-DbContext "Server=aServer;Database=someDb;Trusted_Conn ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : InvalidArgument: (:) [Scaffold-DbContext], ParameterBindingException
FullyQualifiedErrorId : PositionalParameterNotFound,Scaffold-DbContext
Has anybody encounter this issue? Did I miss something? Thanks in advance!
Following are some basic info of the simple project.
IDE: Visual Studio 2017
Target framework: .NET Core 2.1
Installed NuGet Package:
Microsoft.EntityFrameworkCore.Design(2.2.0)
Microsoft.EntityFrameworkCore.SqlServer(2.2.0)
Microsoft.EntityFrameworkCore.Tools(2.2.0)
Microsoft.EntityFrameworkCore.SqlServer.Design(1.1.6)
Like in the reference for Package Manager Console mentioned, you have to write:
-UseDatabaseNames
not
—use-database-names

Add-Migration command not working in EF 7 for UWP app

I'm following getting started with EF 7 for UWP apps official tutorial.
When I'm at Add-Migration MyFirstMigration, it throws following error:
PM> Add-Migration MyFirstMigration
Add-Migration : Exception calling "CreateInstanceAndUnwrap" with "8" argument(s): "Could not load file or assembly 'AppShellProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
or one of its dependencies. An attempt was made to load a program with an incorrect format."
At line:1 char:1
+ Add-Migration MyFirstMigration
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-Migration], MethodInvocationException
+ FullyQualifiedErrorId : BadImageFormatException,Add-Migration
Has anyone figured out any workaround?
Great job #Anil. :)
Actually, since this kind of issue may be related to Visual Studio tools or NuGet. By searching "CreateInstanceAndUnwrap Add-Migration" in EF repository on GitHub, you will see some issues there. If you cannot find any existing issues next time, as same as the questions(project.json, project type and etc. ) I asked, try to find out what's the difference between your steps/configurations and the tutorial will be helpful and you will have more info to get a quick answer.
I believe #bricelam has pointed out the issue you encountered, and no one is more familiar with EF7 than him. I want to pick some key messages from #bricelam in that issue as the ending:
Correct, the Migration commands won't work with x64 assemblies. The current implementation executes inside of an AppDomain created from VS (devenv.exe) which is a 32-bit process.
you'll have to use x86 at design-time.

Enabling Code First Entity Framework VS Web Express 2012

I am trying to enable Code First in my Visual Studio Web Express 2012. From what I have read so far I have to use the Package Manager Console and the command Enable-Migrations. When I do this I get the following error.
Exception calling "LoadFrom" with "1" argument(s): "Could not load file or assembly 'file:///E:\Working\wingtoysdl\C#\packages\EntityFramework.5
.0.0\tools\EntityFramework.PowerShell.Utility.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)"
At E:\Working\wingtoysdl\C#\packages\EntityFramework.5.0.0\tools\EntityFramework.psm1:398 char:62
+ $utilityAssembly = [System.Reflection.Assembly]::LoadFrom <<<< ((Join-Path $toolsPath EntityFramework.PowerShell.Utility.dll))
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
You cannot call a method on a null-valued expression.
At E:\Working\wingtoysdl\C#\packages\EntityFramework.5.0.0\tools\EntityFramework.psm1:399 char:50
+ $dispatcher = $utilityAssembly.CreateInstance <<<< (
+ CategoryInfo : InvalidOperation: (CreateInstance:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Exception calling "CreateInstanceFrom" with "8" argument(s): "Could not load file or assembly 'file:///E:\Working\wingtoysdl\C#\packages\EntityF
ramework.5.0.0\tools\EntityFramework.PowerShell.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515
)"
At E:\Working\wingtoysdl\C#\packages\EntityFramework.5.0.0\tools\EntityFramework.psm1:431 char:31
+ $domain.CreateInstanceFrom <<<< (
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
As you can see it is a very large error making it very hard to google and troubleshoot. Does anyone have any ideas on how I can fix this?
I've run into this issue twice now. Both times I've had to uninstall entity framework then re-install it for each project in the solution. One thing that took me a while to figure out the second time I did this is that I had to re-start Visual Studio (2012) after re-installing Entity Framework (or I continued to get the "Could not load file or assembly '[path]\packages\EntityFramework.5
.0.0\tools\EntityFramework.PowerShell.Utility.dll'" error).
To get to the Package Manager Console go to: Tools -> Library Package Manager -> Package Manager Console
In the Package Manager uninstall Entity Framework for each project (I selected each project from the Default Project dropdown at the top of the Package Manager Console):
Uninstall-Package EntityFramework -Force
Then install it for each project:
Install-Package EntityFramework
At this point attempting to run the Enable-Migrations command gave the error still, until I closed and restarted Visual Studio. Then it was successful, as was the Update-Database command (after setting AutomaticMigrationsEnabled to true in the Migrations.Configuration file).
Had the same issue on two different machines while using projects on a network drive. This answer fixed it for me.
This may be a late answer but this seems like it could be a permissions/access problem.
Make sure that your project is not being opened from a mapped drive or similar.
If you are on a corporate network and logged into a domain, it is very likely that your user profile does not actually sit on your local computer but rather on the server. This will cause the same problem.
Try copy the project to your local c: and try again.
My problem was caused by some projects in my solution not being updated to the same version as other projects. When I ensured all were on the same EF version, it began working.
So I had the same problem for a while, I was unpacking a working project and got the error as I tried to enable migrations. It was simply fixed by using 7-Zip instead of the default unzipper from windows 10
I was also encounter the same problem so I started to check the possible things could go wrong and I found 2 different versions of entity framework is get installed somehow.
To confirm I goto Tools> NuGet package manager solution > Manage NuGet packages > Consolidate.
Have a look below images.
In this picture you may clearly see the different version is installed
in this picture I am agree to update the Entity Framework from 6.2.0 to 6.4.4
I had the same issue and in my case it was network drive problem. When I copied my project in local drive it worked fine.

Resources