我正在使用Windows服务,其中我有一个程序集的引用,它是copy local = false。但是我试图在运行时加载它,虽然当我从visual studio运行它时工作正常但是当我尝试安装它时,cmd会出现这个错误:
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.
此处需要注意的一件事是,如果我将副本本地化为.dll,则可以使安装正常。 BUt我不想在安装之前加载它,所以我想在运行时这样做。
先谢谢。
答案 0 :(得分:1)
也许你需要使用另一个版本的InstallUtil.exe:
尝试使用 Framework64 子文件夹中的 x64 版本。
答案 1 :(得分:0)
此处需要注意的一件事是,如果我将副本本地化为.dll,则可以使安装正常。 BUt我不想在安装之前加载它,所以我想在运行时这样做。
这并不重要,程序集仍然需要进入安装目录。如果您将Copy Local
设置为false
,那么您仍需要通过安装来分发程序集。
答案 2 :(得分:0)
我有一个类似的问题。我做了以下对我有用的工作。
首先,使用FuseLog(装配绑定查看器)确定绑定失败的位置(Described Here
一旦我开始获取日志,我注意到我的日志中有"无效的程序集平台或文件中的ContentType(hr = 0x8007000b)。"