I am starting a new CORE application that uses a SQLServer database, and was using the following command to reverse engineer the current database for a model.
Scaffold-DbContext "Data Source=XXX;Initial Catalog=XXX;User ID=XXX;Password=XXX;MultipleActiveResultSets=True;App=EntityFramework" Microsoft.EntityFrameworkCore.SqlServer -Verbose
This leads to the following error that I have not found any resolution for.
Startup project 'src\XXXtest' is an ASP.NET Core or .NET Core project for Visual Studio 2015. This version of the Entity Framework Core Package Manager Console Tools doesn't support these types of projects.
I have installed packages for NetCoreApp.1.1.1 and Newtonsoft.json. I am using the 4.6.1 framework and using VS2015Community.
Related
I have windows 2008 R2 sp1 server,i want to prepare hosting for project runs on MVC 6 which framework should i i install on server ?
ASP.NET MVC 6 has been rebranded as ASP.NET Core MVC - so if you want to run this, you need to install .NET Core Runtime on your server.
The newest released version is .NET Core v2.2 which you can get from here: https://dotnet.microsoft.com/download
Also, to develop for .NET Core, you'll need the .NET Core v2.2 SDK for your dev machine (which you can download from the same URL).
I tried to use EFCore with SQLite in a Xamarin.Android project. I also added the package Microsoft.EntityFrameworkCore.Tools. When I try to create database migrations I get various errors.
When running dotnet ef migrations add migrationname on the command line I get the error
No executable found matching command "dotnet-ef"
When running Add-Migration migrationname in Package Manager Console I get error
Startup project 'MyProject' targets framework 'MonoAndroid'. The Entity Framework Core Package Manager Console Tools don't support this framework.
Is there some way around this? Do I have to use EF6 instead of
The guidance for unsupported frameworks is to move your DbContext code into a .NET Standard class library and use a dummy .NET Core console app with the tools.
cd MyDbContextProject
dotnet ef migrations add MyMigration --startup-project ..\MyDummyProject
I have created a asp.net mvc core app targeting the .net framework (not the multi platform core) as I want to include standard .net framework libraries and running cross platform is irrelevant to me as I will be hosting in Azure.
The solution looks like this:
I am trying to get a VSTS build working with this project (which is part of a larger solution) but when building I get the following error:
Which seems to be a common error. What should my build definition look like to build these .csproj based projects? There seems to be a lot of information but no definitive answer. Hopefully that answer can be here and people can stop looking elsewhere for information on how to get a Continuous Integration build going.
On a side note at the solution level I find no packages folder containing my nuget packages, why is this? The project definitely contains nuget packages.
Your project is using the newest MSBuild based project files for .NET Core.
The extension is still .csproj, but the XML schema is different than the ordinary .csproj used in .NET46 (and previous versions).
You need appropriate tooling to build such .csproj file, for example:
Visual Studio 2017: install it on your private build agent; VSTS hosted build agent does not have VS2017 installed yet;
.NET Core SDK 1.0.0-preview4-004233 (or more recent): this SDK contains the command line tool 'dotnet' for MSBuild .NET Core based projects.
Note in your build log that the msbuild used is the one shipped with VS2015 (version 14.0) instead, that does not support such .csproj format file.
On the other hand, if you do not need multiplatform nor any other benefit of .NET Core, why are you using it? Just created an ordinary ASP.NET 4 web project targetting .NET 4.6.
At first, I built up a ASP.NET5/MVC6 project with .netcore in VS2015 community, everything was OK. With going deeper and deeper. I have to use session or tempdata, but after I add microsoft.netcore.session package, package restore will fail and all my existing package got NU1002 error said: NU1002 the dependency XXXX in project XXXX does not support framework DNX, version=v4.5.1. Like the picture.
Error on all packages
But if I uninstall the session package, eveything is OK. What's wrong with this ? My sdk version in global.json is 1.0.0-rc1-update1 and I have removed DNX5.0 from project.json. Does anyone could help me?
According to your screenshot you are using DNX framework in your project, which should be the old version ASP.NET 5 project framework. After ASP.NET 5 upgrade to .NET Core, the framework is now called .NETCoreApp. And the SDK version now is 1.0.0-preview2-003121. The error message also means the dependency does not support framework DNX. I have installed the Microsoft.AspNetCore.Session package successful in my Visual Studio 2015 with latest .NET Core SDK version.
So I suggest you download the latest .NET Core SDK installer from below link and then create a new .NET Core application and then move your original project files to the new project and then install the session package.
https://www.microsoft.com/net/download
If your project is create by ASP.NET 5 RC1 project template, please refer to following article to migrate it to ASP.NET Core 1.0.
https://docs.asp.net/en/latest/migration/rc1-to-rtm.html
I am using VS 2013 for application development , I am not sure what version of Entity framework its being used in my project. Is there any way to find out current version of EF using package manager console ?
You could run the Get-Package command targeting the EntityFramework package in the Package Manager Console:
Get-Package EntityFramework
After running the command, you'll see any instances within your solution (or selected scope) where Entity Framework is installed as seen below :