简体   繁体   English

为什么我不能在VB.net中使用SendGrid库?

[英]Why can't I use SendGrid library in VB.net?

Hello today my boss ordered me to use a smtp service named SendGrid and i wanted to know if it is possible to use SendGrid on a VisualBasic project. 您好,今天,我的老板命令我使用名为SendGrid的smtp服务,我想知道是否可以在VisualBasic项目上使用SendGrid。 From their documentation i only see they have libraries on C# and not in VB, so I thought it wasn't possible. 从他们的文档中,我只看到他们在C#上有库,而在VB中没有,所以我认为这是不可能的。

I have referenced the library and imported the namespace, and tried to create an instance of SendGrid.SendGridMessage 我已经引用了该库并导入了名称空间,并试图创建一个SendGrid.SendGridMessage实例。

Imports SendGrid

Public Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Button_Click(sender As Object, e As EventArgs)
        ' Create the mail object first, then add the properties.
        Dim myMsg As SendGrid.SendGridMessage() = New SendGrid.SendGridMessage()
    End Sub

But the compiler gives me this message 但是编译器给我这个信息

Type 'SendGrid.SendGridMessage' is not defined 未定义类型'SendGrid.SendGridMessage'

My IDE showing reference and code 我的IDE显示参考和代码

在此处输入图片说明

I got it working by installing the package SendGrid-Net40 (and its dependencies below automatically). 我通过安装软件包SendGrid-Net40 (及其在下面的依赖项)自动运行。

在此处输入图片说明

This code will now compile 该代码现在将编译

Dim myMsg As New SendGrid.SendGridMessage()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM