Script newbie here. Trying to run a Script Task copied from http://www.nullskull.com/faq/1431/send-authenticated-smtp-email-from-ssis.aspx that will send email to an authenticated SMTP server (basic authentication). Getting the error "Cannot load script for execution" before it can reach any breakpoints I've set in the script. Running on Windows Server 2012 and SQL Server 2012. Data tools and SSMS installed and useable for other things that haven't involved script tasks. Run64BitRuntime set false (didn't work with True either).
Note there is a warning that: 'ScriptMain' is not CLS-compliant because it derives from 'VSTARTScriptObjectModelBase'.
Here's the script - down to just a do-nothing skeleton that still won't load. Warning line indicated by <<<
Thanks for the help.
Imports System
Imports Microsoft.SqlServer.Dts.Runtime
Imports System.Net.Mail
Imports System.Net
Enum ScriptResults
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
End Enum
Public Class ScriptMain ''<<<This line gives the warning about CLS compliance
Inherits Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
Public Sub Main()
Dim Message As MailMessage = New MailMessage()
Dim Smtp As New SmtpClient()
Dim SmtpUser As New System.Net.NetworkCredential()
' other code is normally here...
Try
Smtp.Send(Message)
Dts.TaskResult = ScriptResults.Success
Catch ex As Exception
Dts.TaskResult = ScriptResults.Failure
End Try
End Sub
End Class