visual studio 2013 - Interop assembly not found in F# solution -


f# newbie here, spent many painful hours trying resolve errors simple piece of code msdn f# tutorial.

#r "microsoft.office.interop.excel.dll"  // fails invalid/not found errors  #r "microsoft.office.interop.excel" // works charm. 

any f# gurus know why?

"microsoft.office.interop.excel.dll" name of file (inferred, because of .dll suffix). when supply file name, #r file in file system. since didn't supply path, it'll in present working directory. likely, "microsoft.office.interop.excel.dll" isn't in working directory. explains why first example fails.

"microsoft.office.interop.excel", on other hand, inferred name of assembly (because there's no file extension). assemblies libraries, , distributed in .dll files. don't have to, though; can, example, dynamically emitted @ run-time. additionally, .dll file can technically contain more single assembly, although i've never seen in wild. normal case .dll file contains single assembly, , name of file corresponds name of assembly.

when request load assembly, .net assembly loader (called fusion) starts looking assembly requested identity. it'll start looking in global assembly cache, , guess finds "microsoft.office.interop.excel" assembly there. explains why second example succeeds.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -