如何从netcore成功连接到MySQL。Ubuntu 16.04上的ASP C#
我按照此链接中的说明进行操作 如下图所示。(Program.cs文件) 另外还有ConsoleApp.csproj文件如何从netcore成功连接到MySQL。Ubuntu 16.04上的ASP C#,c#,mysql,nuget,.net-core,ubuntu-16.04,C#,Mysql,Nuget,.net Core,Ubuntu 16.04,我按照此链接中的说明进行操作 如下图所示。(Program.cs文件) 另外还有ConsoleApp.csproj文件 <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>netcoreapp1.1</TargetFramework> </Prop
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.3.0" />
<PackageReference Include="MySql.Data" Version="8.0.8-dmr" />
<PackageReference Include="MySql.Data.EntityFrameworkCore" Version="8.0.8-dmr" />
<PackageReference Include="MySql.Data.EntityFrameworkCore.Design" Version="8.0.8-dmr" />
</ItemGroup>
</Project>
首先使用一个简单的控制台应用程序而不是web来简化错误
但毕竟,我一直在犯以下错误
=====================================================================
dotnet build
Microsoft (R) Build Engine version 15.1.1012.6693
Copyright (C) Microsoft Corporation. All rights reserved.
Program.cs(1,13): error CS0234: The type or namespace name 'XDevAPI' does not exist in the namespace 'MySql' (are you missing an assembly reference?) [/home/filePath/consoleApp/consoleApp.csproj]
Program.cs(2,13): error CS0234: The type or namespace name 'XDevAPI' does not exist in the namespace 'MySql' (are you missing an assembly reference?) [/home/filePath/consoleApp/consoleApp.csproj]
Program.cs(3,13): error CS0234: The type or namespace name 'XDevAPI' does not exist in the namespace 'MySql' (are you missing an assembly reference?) [/home/filePath/consoleApp/consoleApp.csproj]
Build FAILED.
Program.cs(1,13): error CS0234: The type or namespace name 'XDevAPI' does not exist in the namespace 'MySql' (are you missing an assembly reference?) [/home/filePath/consoleApp/consoleApp.csproj]
Program.cs(2,13): error CS0234: The type or namespace name 'XDevAPI' does not exist in the namespace 'MySql' (are you missing an assembly reference?) [/home/filePath/consoleApp/consoleApp.csproj]
Program.cs(3,13): error CS0234: The type or namespace name 'XDevAPI' does not exist in the namespace 'MySql' (are you missing an assembly reference?) [/home/filePath/consoleApp/consoleApp.csproj]
0 Warning(s)
3 Error(s)
Time Elapsed 00:00:02.00
=====================================================================
dotnet build
Microsoft (R) Build Engine version 15.1.1012.6693
Copyright (C) Microsoft Corporation. All rights reserved.
Program.cs(1,13): error CS0234: The type or namespace name 'XDevAPI' does not exist in the namespace 'MySql' (are you missing an assembly reference?) [/home/filePath/consoleApp/consoleApp.csproj]
Program.cs(2,13): error CS0234: The type or namespace name 'XDevAPI' does not exist in the namespace 'MySql' (are you missing an assembly reference?) [/home/filePath/consoleApp/consoleApp.csproj]
Program.cs(3,13): error CS0234: The type or namespace name 'XDevAPI' does not exist in the namespace 'MySql' (are you missing an assembly reference?) [/home/filePath/consoleApp/consoleApp.csproj]
Build FAILED.
Program.cs(1,13): error CS0234: The type or namespace name 'XDevAPI' does not exist in the namespace 'MySql' (are you missing an assembly reference?) [/home/filePath/consoleApp/consoleApp.csproj]
Program.cs(2,13): error CS0234: The type or namespace name 'XDevAPI' does not exist in the namespace 'MySql' (are you missing an assembly reference?) [/home/filePath/consoleApp/consoleApp.csproj]
Program.cs(3,13): error CS0234: The type or namespace name 'XDevAPI' does not exist in the namespace 'MySql' (are you missing an assembly reference?) [/home/filePath/consoleApp/consoleApp.csproj]
0 Warning(s)
3 Error(s)
Time Elapsed 00:00:02.00
是否有我遗漏的东西或我没有安装的东西或什么!
求你了,我真的需要你的帮助来找出问题所在。
谢谢 您在此处标记了asp.net-core-mvc,但您使用的是.net core控制台应用程序。哦,感谢您注意到,我在此处使用.netcore控制台应用程序来了解如何连接,然后再在.netcore web应用程序中使用它#立即编辑它。:)@Janesabouchleich请问您是只使用windows操作系统开发C#web应用程序,还是也使用基于Linux的操作系统,如Ubuntu?我在windows上。也有麻烦让它运行。mscorlib是必需的-这表明它不是在.NET核心/标准上运行,而是在完整的.NET框架上运行。您确定MySql.XDevAPI与.NET Core兼容吗?
dotnet build
Microsoft (R) Build Engine version 15.1.1012.6693
Copyright (C) Microsoft Corporation. All rights reserved.
Program.cs(1,13): error CS0234: The type or namespace name 'XDevAPI' does not exist in the namespace 'MySql' (are you missing an assembly reference?) [/home/filePath/consoleApp/consoleApp.csproj]
Program.cs(2,13): error CS0234: The type or namespace name 'XDevAPI' does not exist in the namespace 'MySql' (are you missing an assembly reference?) [/home/filePath/consoleApp/consoleApp.csproj]
Program.cs(3,13): error CS0234: The type or namespace name 'XDevAPI' does not exist in the namespace 'MySql' (are you missing an assembly reference?) [/home/filePath/consoleApp/consoleApp.csproj]
Build FAILED.
Program.cs(1,13): error CS0234: The type or namespace name 'XDevAPI' does not exist in the namespace 'MySql' (are you missing an assembly reference?) [/home/filePath/consoleApp/consoleApp.csproj]
Program.cs(2,13): error CS0234: The type or namespace name 'XDevAPI' does not exist in the namespace 'MySql' (are you missing an assembly reference?) [/home/filePath/consoleApp/consoleApp.csproj]
Program.cs(3,13): error CS0234: The type or namespace name 'XDevAPI' does not exist in the namespace 'MySql' (are you missing an assembly reference?) [/home/filePath/consoleApp/consoleApp.csproj]
0 Warning(s)
3 Error(s)
Time Elapsed 00:00:02.00