Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Script task Issue:System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly

$
0
0

Hi,

I am new to SSIS.I am using VS2008 and SQL server 2008 R2.I created a small pacakage where there is only one script task.The scrpit task will instatiate a class variable.Theclass is available in a DLL .The problem is that  in script editor I added the reference of DLL which i have created ,and  in Main() method of ScriptMain.cs i am trying to create an instance of the class avaialble in that DLL.It was very straight forward.I compiled the project.And i started running the package.I got the below error

Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'MyClass, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'MyClass, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
   at ST_c018fc39d61c45bb8d4d9d3195c73f16.csproj.ScriptMain.Main()

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable  d:\Program Files\Microsoft SQL Server\100\DTS\binn\DtsDebugHost.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = ABCD

LOG: DisplayName = MyClass, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
 (Fully-specified)
LOG: Appbase = file:///d:/Program Files/Microsoft SQL Server/100/DTS/binn/
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: d:\Program Files\Microsoft SQL Server\100\DTS\binn\DtsDebugHost.exe.Config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///d:/Program Files/Microsoft SQL Server/100/DTS/binn/MyClass.DLL.
LOG: Attempting download of new URL file:///d:/Program Files/Microsoft SQL Server/100/DTS/binn/MyClass/MyClass.DLL.
LOG: Attempting download of new URL file:///d:/Program Files/Microsoft SQL Server/100/DTS/binn/MyClass.EXE.
LOG: Attempting download of new URL file:///d:/Program Files/Microsoft SQL Server/100/DTS/binn/MyClass/MyClass.EXE.

   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
   at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
   at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript().

1.I have tried copying the DLL in to GAC.

2.Copied the dll in to VS installed location from where devenv.exe runs. Stiil the issue persits.Please help.

I have attached the screen shots:

Myclass



Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>