.NETentity framework核心
我已经阅读了过去两年发布的关于EF的几乎所有其他问题。 我没有下载其他软件包的问题,它只是不会为我安装的entity framework。
我甚至尝试安装最新版本的Nuget并在我的项目目录中使用它的工具来恢复包 – 后来我将这行添加到我的.csproj中:
首先我尝试了这个命令:
dotnet restore
输出这个:
C:PathToMyProject>dotnet restore Restore completed in 100.41 ms for C:PathToMyProjectTestNuget.csproj. Restore completed in 68.84 ms for C:PathToMyProjectTestNuget.csproj.
结果如下:
> dotnet ef No executable found matching command "dotnet-ef"
所以我尝试了这个(使用最新版本的Nuget截至今天的日期):
nuget restore Example.csproj
输出这个:
MSBuild auto-detection: using msbuild version '15.6.85.37198' from 'C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuild15.0bin'. Committing restore... Tool assets file has not changed. Skipping assets file write. Path: C:PathToNuget.nugetpackages.toolsmicrosoft.visualstudio.web.codegeneration.tools2.0.3netcoreapp2.0project.assets.json Restore completed in 139.95 ms for C:PathToUsersourcereposExampleExampleExample.csproj. Committing restore... Assets file has not changed. Skipping assets file writing. Path: C:PathToUsersourcereposExampleExampleobjproject.assets.json Restore completed in 113.51 ms for C:PathToUsersourcereposExampleExampleExample.csproj. NuGet Config files used: C:PathToUserAppDataRoamingNuGetNuGet.Config C:Program Files (x86)NuGetConfigMicrosoft.VisualStudio.Offline.config C:Program Files (x86)NuGetConfigMicrosoft.VisualStudio.Offline.Fallback.config Feeds used: C:Program Files (x86)Microsoft SDKsNuGetPackages https://api.nuget.org/v3/index.json
哪个有相同的结果。
我不确定问题是什么,我在网上阅读的所有内容,包括https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/dotnet都说明了你所需要的一切do是改变.csproj文件并使用dotnet / nuget包管理工具进行恢复,但这似乎对我的项目没有任何作用,并且dotnet-ef.exe仍无处可寻。
我做了以下工作,它的工作原理,
- 创建一个新的.NET Core MVC Web App
- 转到命令提示符,将dir更改为您的应用程序项目文件夹
- 执行以下命令
dotnet add package Microsoft.EntityFrameworkCore.Design dotnet restore
执行上述命令后,在.csproj文件中包含以下行(在关闭Project标记之前)
完整的.csproj文件可能如下所示,
netcoreapp2.0
输入dotnet ef
如果所有配置都正常,您将看到以下响应
上述就是C#学习教程:.NETentity framework核心分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!
_/__ ---==/ \ ___ ___ |. | | __|| __| | ) \ | _| | _| _/ | //|\ |___||_| / \/\ Entity Framework Core .NET Command Line Tools 2.0.0-rtm-26452 Usage: dotnet ef [options] [command] Options: --version Show version information -h|--help Show help information -v|--verbose Show verbose output. --no-color Don't colorize output. --prefix-output Prefix output with level. Commands: database Commands to manage the database. dbcontext Commands to manage DbContext types. migrations Commands to manage migrations. Use "dotnet ef [command] --help" for more information about a command.
本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。
ctvol管理联系方式QQ:251552304
本文章地址:https://www.ctvol.com/cdevelopment/949370.html