UWP项目与netcoreapp2.1不兼容 [英] UWP project not compatible with netcoreapp2.1
问题描述
我创建了一个UWP应用,然后我将使用entityFrameworkCore首先使用代码创建数据库.我的应用程序控制台(entityFrameworkCore应用程序)可以工作并创建我的数据库,但是当我引用UWP项目时,它不起作用并显示此错误:
I created an UWP app and I will use entityFrameworkCore to create my DB with code first. My app console (entityFrameworkCore app) works and creates my DB but when I make a reference to my UWP project it doesn't work and shows this error:
uwp项目与netcoreapp2.1(.NETCoreApp,version = v2.1)不兼容
The project uwp is not compatible with netcoreapp2.1(.NETCoreApp,version=v2.1)
当我想在uwp中向数据库项目添加引用时,出现此错误在此处输入图片描述
And when i would like add a reference in uwp to db project i have this error enter image description here
推荐答案
.NET Core应用程序无法添加对UWP应用程序的引用,反之亦然.
A .NET Core app cannot add a reference to a UWP app and vice versa.
您应该做的是创建一个.NET Standard项目,在其中安装Entity Framework Core并定义您的 DbContext
.
What you should do is to create a .NET Standard project where you install Entity Framework Core and define your DbContext
.
然后,您可以从.NET Core控制台应用程序和UWP应用程序中引用该项目.
You could then reference this project from both the .NET Core console app and from the UWP app.
这篇关于UWP项目与netcoreapp2.1不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!