I am trying to load the referenced Assemblies through an iteration.
I load the assembly, and get the referenced assemblies by getRefs. getRefs does not have any input parameters so it should be val getRefs: Assembly->AssemblyName[], but thinks it is unit->AssemblyName[],
any ideas?
let getreffiles (name:string) =
let loadAssembly (name:string)=
Assembly.Load(name)
let getRefs (assembly:Assembly)=
assembly.GetReferencedAssemblies
//Get the referenced assembly list and print the full name to console
name
|>loadAssembly
|>getRefs
|>List.iter (fun s ->
printfn "Referenced Assembly name %s types" s.FullName);;
Type mismatch. Expecting a (unit -> AssemblyName []) -> 'a but given a 'b list -> unit
The type 'unit -> AssemblyName []' does not match the type ''a list'
C:\Users\Ebru\Documents\Visual Studio 2010\Projects\Find\GetAssembly.fs
You have to execute the method GetReferencedAssemblies, by adding a () at the end. Without adding that “()”, you’re simply returning a reference to the function instead of returning the results of the function. Also, change List.iter to Array.iter. GetReferencedAssemblies returns and array, not a list.