Wednesday, 23 May 2012

Changing .Net Framework version in SSIS

Case
SSIS 2008 uses .NET 2.0 as the standard framework version for Script Tasks and Script Components, but in some cases (Service Reference, Linq, etc) you need a higher .NET framework version. How do you change the framework?

Solution
SSIS 2008 supports 3.5 and lower (, but the standard is 2.0). SSIS 2012 supports 4.0 and lower (which is also the standard). Here is how you change it in VB.net and C#.

1) Edit Script
Edit the Script Task or Script Component so that vsta editor is open.

2) Project properties
Right click the project in the Project Explorer (SSIS 2008) / Solution Explorer (SSIS 2012) and select [Properties].
SSIS 2008

SSIS 2012







































3a) Change framework version VB.Net
Go to the Compile tab in the properties page and hit the [Advanced Compile Options...] button. This will open a popup where you can change the framework version in the Target framework dropdownbox. After that hit the OK button and confirm the changes.
5 steps in VB.Net





















3b) Change framework version C#
Go to the Application tab in the properties page and there you can change the framework version in the Target framework dropdownbox. After that you have to confirm the changes.
3 steps in C#






















4) The result
The framework has been changed and all script windows are closed. Open scriptMain.cs / scriptMain.vb (script task) or main.cs / main.cb (script component) to continue scripting.

Tuesday, 17 April 2012

Custom SSIS Component: Foreach File Enumerator with regex

In some cases the standard wildcard filter in the Foreach File Enumerator isn't flexible enough. Try to get all files ending with a number or all files starting with an 'a' or 'b'. A filter based on a regular expression gives more freedom. See/vote this request at Microsoft Connect.

My .Net colleague helped me to create a File Enumerator where I replaced the standard wildcard filter by a regular expression filter. And we also added a sorting possibility.
Regular Expression Support























This Regex File Enumerator also alows you to select multiple extensions like *.xls + *.csv:
^.*\.(xls|csv)$

Disclaimer
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Downloads:
You can download a SSIS 2008 version on the download page. All my custom 2012 enumerators have an optional regex filter included.

Installation
The installer registers the DLL in the GAC and copies it to the ForEachEnumerators folder of SSIS (example: C:\Program Files\Microsoft SQL Server\100\DTS\ForEachEnumerators\). After that you have to close Visual Studio/BIDS because it caches the GAC on startup.

SSIS
The enumerator is automatically added to the Foreach Loop when you open a SSIS project.
The new enumerator




























Bugs or feature suggestions
Please contact me or leave a comment if you have any suggestions or found a bug in this Custom Enumerator.
Related Posts Plugin for WordPress, Blogger...