[英]Visual studio 2015 code not working on Visual Studio code IDE
I have an issue that I've been trying to google and search for many days now and I just can't seem to get it to work. 我有一个问题,我一直在尝试搜索和搜索很多天,但似乎无法正常工作。 So I'm trying to get Visual Studio Code to work and it works fine to some degree.
因此,我正在尝试使Visual Studio Code正常工作,并且在某种程度上可以正常工作。
This is the code I used in Visual Studio 2015: 这是我在Visual Studio 2015中使用的代码:
var client = new SmtpClient
{
Host = "smtp.gmail.com",
Port = 587,
EnableSsl = true,
DeliveryMethod = SmtpDeliveryMethod.Network,
UseDefaultCredentials = false,
Credentials = new NetworkCredential(fromAddress,
fromPassword)
};
So the issue is that I get an error "The type or namespace name 'SmtpClient' could not be found (are you missing a using directive or an assembly reference?) [netcoreapp1.0]" and "The name 'SmtpDeliveryMethod' does not exist in the current context [netcoreapp1.0]" And yes I've installed nuget and I did install all the libraries I need which is System.Net.Mail and the latest version and it just doesn't work and I have no clue why. 因此,问题在于我收到错误消息“找不到类型或名称空间名称'SmtpClient'(您是否缺少using指令或程序集引用?)[netcoreapp1.0]“,并且”名称'SmtpDeliveryMethod'没有找到存在于当前上下文中[netcoreapp1.0]” ,是的,我已经安装了nuget,并且确实安装了我需要的所有库,这些库是System.Net.Mail和最新版本,但是它不起作用,我也不知道为什么。 Anyone have a suggestion?
有人有建议吗?
System.Net.Mail and its SmtpClient are not yet supported in a .NET Core 1.0/1.1 app. .NET Core 1.0 / 1.1应用程序尚不支持System.Net.Mail及其SmtpClient。
Looks like it is scheduled for .NET Core 2.0 https://github.com/dotnet/corefx/issues/1006 看起来像是为.NET Core 2.0安排的https://github.com/dotnet/corefx/issues/1006
You can use MailKit for now: https://github.com/jstedfast/MailKit 您现在可以使用MailKit: https : //github.com/jstedfast/MailKit
or maybe SendGrid https://github.com/sendgrid/sendgrid-csharp 或者也许SendGrid https://github.com/sendgrid/sendgrid-csharp
Try using a full reference. 尝试使用完整的参考。 It seems that the compiler is not finding the reference to that library:
似乎编译器没有找到对该库的引用:
var client = new System.Net.Mail.SmtpClient
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.