February 14, 2018 at 12:07 pm
Hi experts! So I'm running into the following error after adding connection managers to an ssis package: "The type or namespace name 'Runtime' does not exist in the namespace 'Microsoft.SqlServer.Dts' (are you missing an assembly reference?).
I tried opening the script task, clicking on "Edit Script", right clicking on the project in Project Explorer, selecting "Properties" and changing the "Target Framework" to ".Net Framework 3.5", as I've seen suggested on some sites, but no go. I also tried to right click on the project in Project Explorer and selecting "Add Reference", but I don't see 'Microsoft.SqlServer.Dts.Runtime' listed under the .NET tab. I've also tried adding the reference, "Microsoft.SqlServer.ManagedDTS", to no avail. Furthermore, I've tried installing a newer Target Framework, and I received a message saying that I have .Net Framework 4.62, yet it doesn't show up in the Target Framework dropdown when I go to the Project's properties.
Could anyone please advise on the fix for this error? Thanks in advance!
February 14, 2018 at 12:13 pm
daniness - Wednesday, February 14, 2018 12:07 PMHi experts! So I'm running into the following error after adding connection managers to an ssis package: "The type or namespace name 'Runtime' does not exist in the namespace 'Microsoft.SqlServer.Dts' (are you missing an assembly reference?).
I tried opening the script task, clicking on "Edit Script", right clicking on the project in Project Explorer, selecting "Properties" and changing the "Target Framework" to ".Net Framework 3.5", as I've seen suggested on some sites, but no go. I also tried to right click on the project in Project Explorer and selecting "Add Reference", but I don't see 'Microsoft.SqlServer.Dts.Runtime' listed under the .NET tab. I've also tried adding the reference, "Microsoft.SqlServer.ManagedDTS", to no avail. Furthermore, I've tried installing a newer Target Framework, and I received a message saying that I have .Net Framework 4.62, yet it doesn't show up in the Target Framework dropdown when I go to the Project's properties.
Could anyone please advise on the fix for this error? Thanks in advance!
Why would adding a connection manager have any effect on your script task? What does the script task do?
If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.
February 14, 2018 at 12:22 pm
Hi Phil,
The script task basically loops through the multiple connection managers and ensures it's able to successfully connect to each. Any thoughts?
February 14, 2018 at 12:30 pm
daniness - Wednesday, February 14, 2018 12:22 PMHi Phil,The script task basically loops through the multiple connection managers and ensures it's able to successfully connect to each. Any thoughts?
Nothing obvious. Can you share the code you are using?
If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.
February 14, 2018 at 12:37 pm
Sure...this is what's in the Script task:
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
namespace ST_1f50902ce699477fb3cbca2a4fa27b80.csproj
{
[System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
{
#region VSTA generated code
enum ScriptResults
{
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
};
#endregion
/*
The execution engine calls this method when the task executes.
To access the object model, use the Dts property. Connections, variables, events,
and logging features are available as members of the Dts property as shown in the following examples.
To reference a variable, call Dts.Variables["MyCaseSensitiveVariableName"].Value;
To post a log entry, call Dts.Log("This is my log text", 999, null);
To fire an event, call Dts.Events.FireInformation(99, "test", "hit the help message", "", 0, true);
To use the connections collection use something like the following:
ConnectionManager cm = Dts.Connections.Add("OLEDB");
cm.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;Provider=SQLNCLI10;Integrated Security=SSPI;Auto Translate=False;";
Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
To open Help, press F1.
*/
public void Main()
{
bool failure = false;
bool fireAgain = true;
foreach (var ConnMgr in Dts.Connections)
{
Dts.Events.FireInformation(1, "", String.Format("ConnectionManager='{0}', ConnectionString='{1}'",
ConnMgr.Name, ConnMgr.ConnectionString), "", 0, ref fireAgain);
try
{
ConnMgr.AcquireConnection(null);
Dts.Events.FireInformation(1, "", String.Format("Connection acquired successfully on '{0}'",
ConnMgr.Name), "", 0, ref fireAgain);
}
catch (Exception ex)
{
Dts.Events.FireError(-1, "", String.Format("Failed to acquire connection to '{0}'. Error Message='{1}'",
ConnMgr.Name, ex.Message),
"", 0);
failure = true;
}
}
if (failure)
Dts.TaskResult = (int)ScriptResults.Failure;
else
Dts.TaskResult = (int)ScriptResults.Success;
}
}
}
February 14, 2018 at 12:58 pm
OK, I think that error is coming from the Enum.
Can you check your script references? You'll need an entry for Microsoft.SqlServer.ManagedDTS.
If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.
February 14, 2018 at 1:05 pm
Okay, but I do have that reference installed, but it's giving me a warning saying it could not be found, even though I was able to add it from C:\Program Files (x86)\Microsoft SQL Server\120\SDK\Assemblies.
February 14, 2018 at 1:32 pm
That location may not be correct.
Check the properties for Microsoft.SqlServer.ScriptTask & check the path.
The path to the Microsoft.SqlServer.ManagedDTS DLL should be in the same folder as this, I think.
To make the change, you'll have to delete the reference and then add it again.
If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.
February 14, 2018 at 1:40 pm
Okay, thanks for the suggestion. I tried copying the Microsoft.SQLServer.ManagedDTS.dll file from the former location to the same location as the Microsoft.SqlServer.ScriptTask reference (C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Tasks), but it's still not liking it, as it's still giving me the warning that it could not be found:
February 14, 2018 at 1:47 pm
That's odd.
Can you try creating a brand new project from scratch, then adding a connection and a package. Create a script task in your package. The reference mentioned above should be in the script task, by default. Compare this with what you have now to see whether it gives you any clues.
If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.
February 14, 2018 at 2:15 pm
So, I tried that, but it's still a no go, as the reference is still showing with the "could not be found" warning...:doze: ....I'm wondering if it needs to be installed into the global assembly as stated in here: https://technet.microsoft.com/en-us/library/aa337405(v=sql.90).aspx , but not having much luck with this...I've never done it before.
February 14, 2018 at 2:23 pm
daniness - Wednesday, February 14, 2018 2:15 PMSo, I tried that, but it's still a no go, as the reference is still showing with the "could not be found" warning...:doze: ....I'm wondering if it needs to be installed into the global assembly as stated in here: https://technet.microsoft.com/en-us/library/aa337405(v=sql.90).aspx , but not having much luck with this...I've never done it before.
That is worth a try. No harm in getting acquainted with gacutil.
Another thing you could try is a Repair installation of your SSDT/BIDS.
If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.
February 23, 2018 at 8:37 am
I just thought I'd post what ended up happening. I think somehow something somewhere got corrupted. So after talking to a colleague, I deleted the connection managers, and just copied an already existing one. This seemed to have gotten rid of the errors. :Wow:
Viewing 13 posts - 1 through 12 (of 12 total)
You must be logged in to reply to this topic. Login to reply