DbContext not working from Package Manager Console - nuget-package

I am unable to Scaffold-DbContext from Package Manager Console. I have to do this instead "dotnet ef dbcontext scaffold"
Is there anything I can do to fix this on my PC?

Related

Could not load file or assembly 'Microsoft.Azure.WebJobs.Host, Version=3.0.22.0

I have recently cloned a new repository which has AzureFunctions but I am unable to run it. The build succeeds and on Run click it opens a window suggesting that it is downloading Azure
I am using VS2017 and .Net core 2.1.
It seems to be working for other team members but not for me.
I keep getting this 'Could not find Azure.WebJobs.Host...' error continuously.
I've tried all the fixes that are there on the internet without any luck.
The Azure Functions and Web job tools dlls seem to be up-to-date as they are not shown in the updates tab.
Updating all the nuget dependencies also did not work.
I tried using VS2017 and .Net core 2.1.
Installed Microsoft.Azure.WebJobs - 3.022 version from Nuget Packages.
Included Namespace
using Microsoft.Azure.WebJobs.Host;
I found that there is no Microsoft.Azure.WebJobs.Host direct assembly to include.
If you install Microsoft.Azure.WebJobs you can directly use Microsoft.Azure.WebJobs.Host namespace.
Check your .csproj , if you have any PackageReference Included with Microsoft.Azure.WebJobs.Host, try to remove and build your Application.
It must include Microsoft.Azure.WebJobs

ASP.NET Core app build to target Core 2.1 fails on IIS 10 server where Core 2.1 is installed

I have just setup up IIS 10 on a clean Server 2016 hosted server, and installed the following packages that I have gleaned should be on the machine to allow IIS to host ASP.NET Core applications:
aspnetcore-runtime-2.1.0-win-x64.exe
dotnet-hosting-2.1.0-win.exe
dotnet-runtime-2.1.0-win-x64.exe
I have installed my app straight into the Default Web Site and replaced all files in C:\inetpub\wwwroot\ with my app files. I also did assign the web site an app pool with no managed code, so that isn't my problem.
Last time my app was built with 2.0, and I installed the latest versions of the above packages, which I'm sure was 2.0, and the only error I had was that the command dotnet that IIS uses to invoke Kestrel to run the site, was not in the PATH env. variable
Now when I try and browse to localhost on the Server 2016 machine, it gives me the following error, found in the Windows event log:
Application 'MACHINE/WEBROOT/APPHOST/DEFAULT WEB SITE' with physical
root 'C:\inetpub\wwwroot\' failed to start process with commandline
'dotnet .\QuickDrive.Mvc.dll', ErrorCode = '0x80004005 : 8000808c.
Initially I tried with the same build as before, which was 2.0, and when I got this error, I rebuilt the app to target 2.1. Nearly every search result and relevant SO answer I can find suggest a version conflict, but now there should at least be no version conflict between the runtime and hosting package on the server. Maybe there are other version conflicts I am not aware of though?
At very least I'm asking for some advice on how to get more detailed diagnostic information, even if I don't get an answer that tells me straight what config options and versions to check on Windows and on IIS.
You have to install the Core SDK for whatever version you want to target in Visual Studio. Installing the runtime alone won't do the trick. You may have the restart Visual Studio afterward to see it in the list.
Here is a link to the SDK 2.1 download (the latest as of this writing).
I solved the problem by running dotnet myWesite.dll in PowerShell, and first I found that dotnet.exe was not in the PATH environment variable, and after fixing that, running dotnet myWesite.dll again gave me a meaningful error message that an assembly was missing because it had not been included when I published the website.
I faced the same error on the dev machine in IIS Express. MVC App stopped working all of the sudden. Eventlog gave the 0x80004005 error code.
After trying multiple suggestions, the solution to debug the wired error code was to run the app in the console:
[Project bin folder]> dotnet [projectname].dll
It appeared that during the NuGet package update, the dotnet core version was accidentally updated to 2.1.4 where as the installed version was 2.1.3
[could be a bug in Nuget manager as the update was from there]
I edited the project file to reference the available version (2.1.3) and the app started to work properly.

Error 502.5 on my Azure Web app with dotnet core 2.0

I have a web application developed with Asp.Net Core 1.1 deployed on Azure and it works well. I just migrated projects to use Asp.Net Core 2.0 and tried to deploy it on Azure. The deployment went well, but when I open the site, I have a 502.5 error. When I check my Azure log feed, I get the following error:
This error occurs when a CGI application does not return a valid set of HTTP headers, or when a proxy or gateway could not send the request to a parental gateway. You may need to get a network trace or contact the proxy server administrator if this is not a CGI problem.
Needless to say, it works well on my development machine with the same code.
For more information, the way I migrated from 1.1 to 2.0 is to change the settings of the target structure to "netcoreapp2.0" and use the NuGet package "Microsoft.AspNetCore.All".
When I use the web application console in azure and run: dotnet mywebapp.dll, I have the following error:
It was not possible to find a compatible frame version
The specified 'Microsoft.NETCore.App' frame, version '2.0.0' was not found.
- Check the application's dependencies and target a version of the framework installed at:
\
- Alternatively, install the version of the '2.0.0'
Dotnet --version:
2.0.0-preview2-006497
my csproj target the good framework:
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<PropertyGroup>
I also removed content of site\wwwroot and redeploy, but no change.
What is wrong ?
In local, I run : Update-Package -reinstall
One package was update in one project.
Then I deploy again and everything is ok

NLua nuget package restore failed in VS 2017

I am trying to create a .NET 4.6.1 Class Library an use this nuget package with it:
https://www.nuget.org/packages/NLua/
When I click install I get this message:
Package restore failed. Rolling back package changes for 'ClassLibrary1'.
If I try the same install with a web application in the same solution, the install completes successfully.
You are probably creating a "Standard" library, but if you want to add NuGet packages to it then you need to create a "Framework" library. At least that's how I got it to work.

publish and deploying .net core application to linux

Im having truble with publish and deploying a .net core web-api on a ubuntu 16.04 desktop ran in vmware. I have developed a simple web-api application with almost no extra implementation from the template v1.1. I have been installing and using some dependencies that are runnable in .net core.
Problem:
Im using framework dependent release v1.1.
I can launch a released version on windows by using "dotnet publish -c release" and it works fine. I then move the published files to my ubuntu machine and tries to run it I get the error that it cannot locate some kind of assembly that I know is in the dll folder.
However if I move the source code and project to my ubuntu machine and do a "dotnet restore" and "dotnet publish -c release" the application works. If I dont use the "dotnet restore" and tries to publish on my ubuntu machine it gets another "are you missing an assembly reference".
My guess is that when I do "dotnet publish -c release" it targets runtimes only for windows or ubuntu depending on the machine publishing.
Im grateful for help and explanation for this.
Sorry for bad language.
Stupid me have been running the wrong application dll. I always ran the application dll in the folder netcoreapp1.1 when I should have ran the same dll in the sub directory publish.

Resources