I have used Microsoft.SqlServer.Dts.Runtime to run package in ASP.NET MVC. However I need to run this in asp.net core. As we cannot add individual dll in asp.net core, I was wondering if anyone has idea if there is nuget package which would help.
Just to elaborate on how I resolved this issue. Below is the answer
To run SSIS package you need below DLLs in the code
Microsoft.SqlServer.ManagedDTS.dll
Microsoft.SqlServer.PipelineHost.dll
Microsoft.SqlServer.DTSRuntimeWrap.dll
Microsoft.SqlServer.DTSPipelineWrap.dll
It is easy to add DLLs in MVC projects, however in asp.net core it needs to be in form of a Nuget package.
So nuget package can be easily created using nuget package explorer. Below is the link
https://docs.nuget.org/create/using-a-gui-to-build-packages
In the nuget package explorer add a lib folder, inside that add a .net folder dnxcore50 and add the above DLLs. Click on tools analyse package and save the nuget
In the visual studio 2015 solution, you can refer local packages. Tools - Nuget Package Manager - Package Manager Settings - Package source add the local package path.
After which you will be able to add the nuget package using nuget package manager and select local package as source
If there is error in restoring package, add dnxcore to imports section and add "Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc2-24027" to dependencies in project.json
"dependencies": {
"Microsoft.AspNet.Hosting": "1.0.0-rc1-final",
"Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc2-24027",
"SSISPackage": "1.0.0"
}
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8",
"dnxcore"
]
}
}
After which you will be able to use code to run SSIS package similar to MVC projects.
Application app = new Application();
Package package = null;
try
{
package = app.LoadPackage(@"C:\Files\Package.dtsx", null);
Variables vars = package.Variables;
vars["status"].Value = "ACTIVE";
DTSExecResult results = package.Execute();
}
catch
{
return false;
}
finally
{
package.Dispose();
package = null;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With