Run .NET 4 code from script component SSIS 2008 - ssis

I need to run custom code from SSIS script component. As I know it supports .NET 2-3.5.
Can you tell me please a workaround of doing this?
Thanks.

Create a web service/WCF service to call the .NET 4.0 custom code and invoke the custom code from the Script Component through the service.
Here is a link that shows How to Configure an SSIS Package to Access a Web Service using WCF. It is not exactly the same as what you are looking for but I hope that should give you an idea.

Compile it as an .exe and run it in an 'Execute Process Task'

Related

troubles publishing closedxml to azure app service

When I try to publish my webAPI to azure I get this error
It says something about degradation of the package. Reference it directly from the project but I don't know what is needed
Any idea Please?
Regards
I solved installing the package directly in the project
thanks

SSIS C# Script using Google.Apis.Auth.OAuth2;

I made a C# Script in SSIS pulling data from GA API. On Monday, Google closed the access to the api via basic authentication
AnalyticsService service = new AnalyticsService(Dts.Variables["CONFIG_GA_PROJECT"].Value.ToString());
service.setUserCredentials(username, pass);
=> Got 404 error
So I want to move to the following security implementation : Accessing older GData APIs (Spreadsheet API) using OAuth 2 and a service account
The problem is : seems like we can't use nuget installation in SSIS Script as dll has to be pushed in the GAC.
I tried using : How to install a DLL to the GAC on Windows Server 2012 using only PowerShell (without having to install SDK or Visual Studio) but didn't work...
Is anyone found a way to use Google.Apis.Auth.dll in a SSIS C# Script task ?
The problem you are having is due to the fact that the Google .net client library aren't strong name signed, so they cant be pushed to GAC. Also remember that the current Google .net client only works with .net 4 and .net 4.5 so you are going to be locking out the older versions of SSIS I think.
This is reason I didn't use them in my Google Analytics Custom SSIS Data Reader and Connection Manager which uses Oauth2.
Options:
Strong name sign the Client library yourself. code here
Wait for the strong name signed version of the library to be released. I hope its done soon. Strong Naming in binaries #238
Do what I did and code it all yourself with out the Client library, this allows you to code for .net 3.0 and support SQL server 2005 - 2012 like mine.
I hope this helps. The one I made is free for download you are welcome to have a look Data Reader for Google Analytics

How to run SSIS packages from an external application?

I have an application I am writing that accepts files of various formats. Then I write code for each format (csv, excel, xml) to convert it and enter it into a SQL Server database. This is fine but I was just looking into SSIS and wondering if this would help.
The main question though is how do I run these packages within my own code? Is it easy to pass parameters? If I move this web app to another server does it depend on other components being on that server (maybe SQL Server 2012 installed)? Or is it just some DLLs I can reference from my web app?
All the demos I see are about using the SSIS tool but I am more interested in how difficult it is to call packages with parameters from my code.
The BIDS/SSDT installation includes a complete client SDK that makes it pretty simple to run SSIS packages via code.
This MSDN article explains how to load and run a package via C# in detail but the actual code boils down to:
using Microsoft.SqlServer.Dts.Runtime;
.
.
.
Application app = new Application();
Package pkg = app.LoadPackage(PKG_FILE_NAME, null);
DTSExecResult pkgResults = pkg.Execute();
The Package object has a lot of properties and methods you can look into, in particular there is a Parameters collection that allows you to pass parameters into your SSIS package before execution.
There is a very cool library called EzAPI where you can generate your own packages and call them from within C#. It gives you a lot of flexibility to generate SSIS on the fly and execute.
http://sqlsrvintegrationsrv.codeplex.com/releases/view/21238
I built a couple console apps inside this project to test some of these methods and you might find the examples useful:
https://github.com/thevinnie/SyncDatabases
Look at "BuildingAPackage" and "BuildALookupPackage"
You can programmatically build SSIS packages using C# or VB.NET and then run the packages. You can also load an existing package programmatically to execute it. I have little experience with building packages this way since most of the packages can be built easily using the following tools.
Read the article Building Packages Programmatically on MSDN for more details.
I feel that it is easier to build the packages through these IDEs depending on which version of SSIS you are targeting. You can also create initial packages through SQL Server Import and Export Wizard and save the SSIS packages to the local disk, which you can later modify according to your needs.
SSIS Version Development IDE Visual Studio Shell
------------------- ----------------------------------------------- -------------------
SSIS 2005 Business Intelligence Development Studio (BIDS) Visual Studio 2005
SSIS 2008 - 2008 R2 Business Intelligence Development Studio (BIDS) Visual Studio 2008
SSIS 2012 SQL Server Data Tools (SSDT) Visual Studio 2010
You need to reference the appropriate SSIS specific DLLs in your code to create/load SSIS packages.
However, you will need a SQL Server Integration Services license to run the package. You cannot simply reference the DLLs alone. The license is usually part of your SQL Server license, if you already have one.
Response to your comment:
We will have SQL 2012 or 2008R2 on a separate server.. So I just need to paste the needed DLLs on my web server and reference them. correct ?
The packages will execute on that server. You are just remotely invoking to execute them and you should reference the appropriate DLLs in the code within your web/other form of external application. I usually schedule the packages to run on the database servers under SQL Server Agent Job. You can try that if that is an option for you.
Package parameters are read-only from an external application. You'll need to pass them in as variables (which I have done). If you are dealing with an existing package with parameters, you may consider writing a script task that populates the parameters from the variables (which I have not done).

How do I execute an SSIS 2008 package from .NET 4.0 Windows Service?

I have a .NET 4.0 Windows service application (VS2010), I need to call an SSIS 2008 package.
I know that it is easier to create a web service and call that service from SSIS, I am not at liberty to do that.
So, I figured my next best option is to call my SSIS package from my windows service. I know in .NET 2.0 you can call the DTS package, and if i have SQL Server 2012 installed.
But I am not able to find a solution for this specific combination. .NET 4 and SQL server 2008 SSIS.
Or is there a way using the same combination that i can start and stop a windows service using SSIS 2008. And figure out when the windows service is finished running.
Refer the section Using a Web Service or Remote Component to Run a Remote Package Programmatically in the below MSDN documentation.
Loading and Running a Remote Package Programmatically

Associating C# Web application code in an SSIS Package

I am new to SSIS package and don’t have enough knowledge of the same. Below are some of my requirements:
I have a C# web application which reads data from an excel file, and we just need to give the folder path and its reads all excel files data in that folder.
Then I am putting that data in sql database.
I want to associate this C# web application code with an SSIS Package.
Can anyone give me steps how to create an SSIS package and how to associate this package with the c# code?
Yes you can do by following steps.
1. Create SSIS package - Please do search how to create SSIS package.
2. Host web application with dynamic loading package there you can update all configuration parameters dynamicaly.
3. I hope folder you mentioned in the server, if not then it has to be
go through this - Programatically load SSIS package configurations
please let me know if you need further help