Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Service: System.Reflection.ReflectionTypeLoadException was thrown with the following error message: Unable to load one or more of the re

I am using a windows service, In which I am having a reference of an assembly which is copy local= false. But I am trying to load it at runtime, which is though working fine when I am running it from visual studio, But when I try to install it, cmd gives this error:

An exception occurred while trying to find the installers in the D:\Official\Pro
jects\20131007_ImproveDN\build\debug\application
s\SubscriptionService\SubscriptionService.exe assembly.
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the
 requested types. Retrieve the LoaderExceptions property for more information.
Aborting installation for D:\Official\Projects\2
0131007_ImproveDN\build\debug\applications\SubscriptionService\SubscriptionServi
ce.exe.
An exception occurred during the Rollback phase of the System.Configuration.Inst
all.AssemblyInstaller installer.
System.InvalidOperationException: Unable to get installer types in the D:\Offici
al\Projects\\20131007_ImproveDN\build\debug\appli
cations\SubscriptionService\SubscriptionService.exe assembly.
The inner exception System.Reflection.ReflectionTypeLoadException was thrown wit
h the following error message: Unable to load one or more of the requested types
. Retrieve the LoaderExceptions property for more information..
An exception occurred during the Rollback phase of the installation. This except
ion will be ignored and the rollback will continue. However, the machine might n
ot fully revert to its initial state after the rollback is complete.

Also one thing to note here is that If I make copy local true of that .dll it makes installation fine. BUt I dont want to load it before installation so I want to do it at runtime.

Thanks in Advance.

like image 952
eLs Avatar asked Oct 14 '13 12:10

eLs


1 Answers

Maybe you need to use another version of InstallUtil.exe:

  • c:\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe
  • c:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe
  • c:\Windows\Microsoft.NET\Framework64\v2.0.50727\InstallUtil.exe
  • c:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe

Try to use x64 version from Framework64 subfolder.

like image 65
SKINDER Avatar answered Oct 18 '22 19:10

SKINDER