1
votes

I am trying to create a simple flow using the BIML <ScriptComponentProject> tag, but it does not work for me!

  • if I create the data flow manually, then it works perfectly fine!

    • my data flow has: SRC > SCRIPT-COMPONENT > TGT
    • the only logic that I have added is to calculate a row-number for each incoming row (keeping the logic absolutely simple for now)
  • when the manual solution is executed:

    • the sequential row-number is stored in the TGT table (test_np_02)
    • Great!
  • however, when I try to create absolutely the same package using the attached BIML, I get the following errors:


SSIS Output log:

Error 0 The namespace '<global namespace>' already contains a definition for 'Input0Buffer'.  ...\Designer\BufferWrapper.cs    14 14
Error 0 The namespace '<global namespace>' already contains a definition for 'UserComponent'. ...\Designer\ComponentWrapper.cs 12 14
Error 0 The namespace '<global namespace>' already contains a definition for 'Connections'.   ...\Designer\ComponentWrapper.cs 49 14
Error 0 The namespace '<global namespace>' already contains a definition for 'Variables'.     ...\Designer\ComponentWrapper.cs 60 14
EmitSsis. Internal Compiler Error: Workflow EmitSsis contains fatal errors. Phase execution halted.


I am unsure what is going wrong when I try to create the PKG using BIML:

  • these errors never popped up when I created the package manually (with the same code)
  • I copy-pasted the important C# files from the manual solution into the BIML


Questions / Ideas:

  1. is it something to do with the GUID that has to be used for ProjectCoreName, AssemblyProduct and AssemblyTitle?

    • is this automatically generated each time the BIML is expanded?
    • if so, how can I create a GUID in the BIML itself for these items .. so that it works directly after expansion?
  2. is it something to do with the sequence in which I have to create the .cs files in the BIML, within the <Files> tag?

    • I currently assume that actual sequence of the <File> items within the <Files> tag is not relevant for BIML
  3. could it be that I have to generate "Resources.resx/Resources.Designer.cs" and "Settings.settings/Settings.Designer.cs" as well in the BIML?

  4. is it really important to have the "#region Namespaces" section in each .cs file?

    • I removed that from the manual soln .. that still worked fine !


Pls help.

Notes:

  • I am using SSDT 2015 and Varigence BIMLExpress 2017 (Build 5.0.61915.0)

  • I am aware that this could very easily be done using ROW_NUMBER() within SQLServer in the SRC itself, but:

    • I am using OleDbSource in the attached example just to keep it simple
    • finally, I will have to generate hundreds of code PKGs with BIML, which will have the SRC as a flat file, and not OleDB.
    • and obviously, I would love to have my generated ScriptComponents work immediately after expansion .. without any further manual interventions :)


Thanx,


NP


BIML file: https://drive.google.com/file/d/10O3aSL5IO34ULS44wl7IX4LUmPH_pI6V/view?usp=sharing

1

1 Answers

1
votes

The error will disappear if you wrap your classes in a custom namespace.

namespace SomeNamespace {
    public class UserComponent: ScriptComponent
    {
         ...
    }

    public class Connections
    {
          ...    
    }

    public class Variables
    {
          ...     
    }
}

namespace SomeNamespace {

    public class Input0Buffer: ScriptBuffer
    {
         ...
    }
}

Also one remark about (dynamically) creating multiple packages from this Biml file: You will have to assign a dynamic namespace name like so:

namespace <#=variableContainingNamespaceName#> {
    ...
}

About your remarks:

  1. The issue is not related to the ProjectCoreName, but I fear that you may run into issues if you reuse the same ProjectCoreName for multiple packages generated from the same biml (without having actually tested it)
  2. No
  3. Not necessary
  4. No, the section is not necessarily required.