dotnet add package MySql.Data --version 8.4.0
正在确定要还原的项目…
Writing C:\Users\Administrator\AppData\Local\Temp\1\tmp2lmarc.tmp
info : X.509 证书链验证将使用 .NET 选择的默认信任存储进行代码签名。
info : X.509 证书链验证将使用 .NET 选择的默认信任存储进行时间戳。
info : 正在将包“MySql.Data”的 PackageReference 添加到项目“C:\sys\tools\Windows-Service-Threading-master\WindowsService\WindowsService.csproj”。
info : 正在还原 C:\sys\tools\Windows-Service-Threading-master\WindowsService\WindowsService.csproj 的包...
info : CACHE https://api.nuget.org/v3/vulnerabilities/index.json
info : CACHE https://api.nuget.org/v3/vulnerabilities/vulnerability.base.json
info : CACHE https://api.nuget.org/v3/vulnerabilities/vulnerability.update.json
info : 包“MySql.Data”与项目“C:\sys\tools\Windows-Service-Threading-master\WindowsService\WindowsService.csproj”中指 定的所有框架均兼容。
info : 包“MySql.Data”(版本为 8.4.0)的 PackageReference 已添加到文件“C:\sys\tools\Windows-Service-Threading-master\WindowsService\WindowsService.csproj”。
info : 资产文件未改变。跳过资产文件写入。路径: C:\sys\tools\Windows-Service-Threading-master\WindowsService\obj\project.assets.json
log : 已还原 C:\sys\tools\Windows-Service-Threading-master\WindowsService\WindowsService.csproj (用时 345 毫秒)。
在CSPROJ里面添加了:
<ItemGroup>
<PackageReference Include="MySql.Data" Version="8.4.0" />
</ItemGroup>
现在在DOTNET BUILD 时仍然报错:
C:\sys\tools\Windows-Service-Threading-master\WindowsService\Service1.cs(14,7): error CS0246: 未能找到类型或命名空间名“MySql”(是否缺少
using 指令或程序集引用?) [C:\sys\tools\Windows-Service-Threading-master\WindowsService\WindowsService.csproj]
39 个警告
1 个错误
原来是在WIN11上写好的源码, 部署到SERVER 2022, 需要重新编译,没安装VS2019 ,而是只下载了 dotnet 和 sdk,