']]>' is not allowed in character data within ssis script task

时间:2016-02-12 19:53:58

标签: c# sql-server visual-studio ssis

I have a SSIS Script task that I am using inVS 2012 Integrated shell (SSDT-BI development) and I am running into an odd error.

Basically, my code kept crashing VS when I closed the Script Task editor. It prompted me with the error:

"Failure saving package. ']]>' is not allowed in character data. (Microsoft.SqlServer.ManagedDTS).

Is also gives me:

"Cannot show the editor for this task. Exception from HRESULT: 0x80131940 (Microsoft.SqlServerDTSRuntimeWrap)."

Then VS will crash and restart itself.

So judging by the error, it doesn't seem to link the string I am passing into a variable, which I was able to verify using the below code (which triggers the exact same error).

What am I missing here... is this a bug? I am sure I'm just blatantly missing a whitepaper or something on this subject but why can't the below code work in SSIS Script task? I know it would for a C# console app.

[Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute]
    public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
    {
        public void Main()
        {
            // TODO: Add your code here
            string hi = "<![CDATA[" + "]]>";

            Dts.TaskResult = (int)ScriptResults.Success;
        }

        #region ScriptResults declaration
        enum ScriptResults
        {
            Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
            Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
        };
        #endregion
    }

1 个答案:

答案 0 :(得分:1)

You can't use std::swap or ]]> as the script code itself is saved as XML inside your package.

<