0

Firstly I'm new to this segment of SSIS.

I installed LinqToExcel via NuGet and it installs without any errors and builds code without errors. When I close the script task and run the package, it errors out.

When I go into the task it tells me:

Error 1 The type or namespace name 'LinqToExcel' could not be found (are you missing a using directive or an assembly reference?) C:\Users\rbaker\AppData\Local\Temp\Vsta\SSIS_ST110\Vstad_qPoA0KfUWEZIzHIiXSiA\VstaQ4Oa6ZSBuU2GsGZFjuGlnA\ScriptMain.cs 6 7 ST_f0d6822b1b2e4b77b311f38707c40306

Under the reference tab assigned to the LinqToExcel it shows yellow triangles.

Any ideas how I can resolve this?

Gidil
  • 4,137
  • 2
  • 34
  • 50

1 Answers1

0

Seems like this is happening because of your project's targeting .Net framework. As you mentioned your are using SSIS 2012 then by default the framework would be 4.5/4. So try changing it to 3.5/3.

If this doesn't work then you can manually add LinqToExcel libraries by downloading from here. Before adding, first delete yellow marked one.

Vikramsinh Shinde
  • 2,742
  • 2
  • 23
  • 29
  • Hey That's fixed the first problem, now its building with no errors but failing when the SSIS runs. But the SSIS debugger isnt the best. Can you see anything wrong here? string fPath = @"J:\Richard Baker\SSIS_Holding_Folder\applications.xlsx"; var excel = new ExcelQueryFactory(fPath); var dataContent = from c in excel.WorksheetRangeNoHeader("A1", "B1") select c; Cheers – user3801561 Jul 03 '14 at 14:25
  • what error you are getting.. any error message/code? – Vikramsinh Shinde Jul 03 '14 at 14:27
  • All you get is: Exception has been thrown by the target of an invocation. Now this same script runs outside SSIS inside visual studio. I'm confused. – user3801561 Jul 03 '14 at 14:31
  • try checking what's the excel version and SSIS version (32 or 64 bit), also check for ReadOnlyVariables and ReadWriteVariables has been set properly in your script component. Put a breakpoint into the Main() method of my script and try debugging the package again. – Vikramsinh Shinde Jul 03 '14 at 14:38
  • OK adding a breakpoint didnt didnt do anything, stopped, loaded up the script window and then errored. I have scaled back all the code and found the problem area: string fPath = @"J:\Richard Baker\SSIS_Holding_Folder\applications.xlsx"; var excel = new ExcelQueryFactory(fPath); Ive checked that the .Net framework match and the 32/64bit. Its set to 32bit (same as the linq package). Is it a simple case that you can nit use LinqExcel in SSIS? – user3801561 Jul 03 '14 at 14:49
  • It is working with SSIS. Have a closer look of this you might get clue - http://stackoverflow.com/questions/17042571/importing-data-with-linqtoexcel – Vikramsinh Shinde Jul 03 '14 at 14:52
  • To be able to have the debugger hit your breakpoint, you should change your SSIS Project's "Run64BitRuntime" propery's value from its default True to False as follows : – Vikramsinh Shinde Jul 03 '14 at 14:57
  • Debugging SSIS ScriptTasks and ScriptComponents with Information Messages : http://geekswithblogs.net/darrengosbell/archive/2009/03/29/debugging-ssis-scripttasks-and-scriptcomponents-with-information-messages.aspx – Vikramsinh Shinde Jul 03 '14 at 15:01
  • if you are setting Run64BitRuntime property then your "Script Task" is still compiled as 64bit. You should edit your Script Task with "Edit Script" and save it again. This will help your script task code to be compiled as 32bit. – Vikramsinh Shinde Jul 03 '14 at 15:04