How to run ssis package in asp.net core application? - asp.net

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;
}

You can package the assembly into a nuget package, Create a Lib folder inside your solution to hold the nuget package, then, create a nuget.config file to set the package sources to include the Lib folder inside your solution.
The following links contains more details about creating nuget package and hosting it locally:
https://docs.nuget.org/create/creating-and-publishing-a-package
https://docs.nuget.org/create/hosting-your-own-nuget-feeds
https://docs.nuget.org/consume/nuget-config-file
Hope that helps

You may now reference the dlls ( one from each) directly in your .net core project from the below locations to run ssis packages now
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SqlServer.ManagedDTS
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SqlServer.PipelineHost
C:\Windows\Microsoft.NET\assembly\GAC_64\Microsoft.SqlServer.DTSRuntimeWrap
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SqlServer.DTSPipelineWrap
you no longer need to create a nuget package

Related

Popper's tooltip.js NuGet package

I have downloaded the popper.js NuGet package for some bootstrap features. It works.
Now I want to test and use other their feature - tooltip.js.
In the readme.md file is information about instalation of poppers.js throught NuGet but there is no info about the Tooltips.js.
There is no package in NuGet with 'Tooltip.js' name.
How shoud I install and use it in asp.net application correctly?
Does it available at all for .NET (yes I am a newbie)?
May be poppesr's js files already include the code of their tooltip framework?

.net core package restore failed

Package restore
Package restore failed in ASP.NET Core 1.1.
Note: I am targeting following in my project.
"frameworks": {
"net461": { }
},
Recently I upgraded my project from ASP.NET Core 1.0 to 1.1 and it worked fine on my old laptop until I switched the project to fresh new laptop, and installed visual studio 15. Here is the configuration of the VS 15.
I have also installed the required SDK as mentioned on this link
https://jeremylindsayni.wordpress.com/2016/11/20/upgrading-from-net-core-1-0-t0-1-1-with-visual-studio-2015/
Now my project.json file looks likes this.
And global.json looks like this.
{
"projects": [ "." ]
}
But as you can see the packages are not loading as expected. When I run dotnet restore from the package manager console I get something like this.
Any ideas ??
I fixed same issue when i add file
If you see this error with adding some code file for example Controller, View etc.
Than one of reasons is CodeGeneration package failed when you try to add some file.
add nuget package which is
Microsoft.VisualStudio.Web.CodeGeneration.Design

Asp.net Entity Framework.6.1.3 NuGet package - what are folders net40 and net45

Can anyone tell me in Asp.net EntityFramework.6.1.3 NuGet package, what are the folders net40 and net45?
The folders contain version-specific assemblies of the EF6 library.
When you install a package manually using the Package Manager Console, the software creates two EntityFramework libraries (4.0 and 4.5) and automatically adds a reference to the correct library based on the selected project.
If you are not installing this using the command line tool, choose the library version that matches your target framework.

Is it possible to add a reference to NetCore library from a NetCore app without using the same solution?

I have a netstandard1.6 Project "MyLibrary"
I have a netcoreapp1.0 Project "MyApplication"
I have to reference "MyLibrary" from "MyApplication", without having those on the same solution.
Is it possible? How?
It's really confusing how DNX RC1 jumped into what Asp .Net 5 is right now, I can't seem to get going with it, I've read several articles and no documentation answered those questions to me.
With .Net Core, there are two ways to reference dependencies:
Reference another project in the "solution", where the solution is specified by a global.json file.
For example, the relevant part of your project.json could look like this:
"dependencies": {
"MyLibrary": { "target": "project" }
}
Reference a NuGet package from a known package source. Package source can be either web-based (like nuget.org), or it can be a directory. You can configure known package sources either locally or globally using a nuget.config file.
Example project.json excerpt:
"dependencies": {
"MyLibrary": "1.0.0"
}
For you, this means you have two options:
Add the library project to your "solution" by including it in your global.json.
Produce a NuGet package from your library (you can use dotnet pack for that), place it into a package source (probably just a directory) and configure that package source in a nuget.config file.

ASP.NET Core 1 RC2 add reference to "Microsoft.Data.SqlXml"

I created a MVC 6 project with RC1 and added reference to "Microsoft.Data.SqlXml" with no problem. When I migrated to RC2, I can not add the reference to "Microsoft.Data.SqlXml". I get an error message ".Net Core projects only support referencing .NET framework assemblies in this release. To reference other assemblies, they need to be included in a NuGet package and reference that package." Is there a easy way I can add the reference?
I'm finally able to add the reference "Microsoft.Data.SqlXml" by creating NuGet package, to the project migrated to RC2.
Publish RC1 project to file system and find out the package folder "Microsoft.Data.SqlXml" under "PublishOutput"
Download Nuget Package Explorer and open the .nuspec file in "Microsoft.Data.SqlXml" package folder.
Edit the files .nuspec, project.json, project.lock.json in Nuget Package Explorer, change all words "DNX" -> ".NETFramework", and "Save As" package file Microsoft.Data.SqlXml.nupkg.
In VS 2015, Tools -> NuGet Package Manager -> Setting, add local folder to package source list, then copy the .nupkg file to the folder
Install the Microsoft.Data.SqlXml NuGet package from the local source
I don't know why MS made the thing so complicated, 2 seconds work in RC1 but took me one day to figure it out in RC2.

Resources