C#自定义操作dll-访问被拒绝

C#自定义操作dll-访问被拒绝,c#,windows,windows-installer,custom-action,advanced-installer,C#,Windows,Windows Installer,Custom Action,Advanced Installer,这似乎是一个环境问题,因为它目前正在影响一个用户(据我们所知) 我们使用一个C#自定义操作dll,它依赖于MSI中的实用程序dll。使用这些文件调用第一个自定义操作时,用户将获得: SFXCA: Extracting custom action to temporary directory: C:\Windows\Installer\MSIBAA4.tmp-\ SFXCA: Binding to CLR version v4.0.30319 Calling custom action Custo

这似乎是一个环境问题,因为它目前正在影响一个用户(据我们所知)

我们使用一个C#自定义操作dll,它依赖于MSI中的实用程序dll。使用这些文件调用第一个自定义操作时,用户将获得:

SFXCA: Extracting custom action to temporary directory:
C:\Windows\Installer\MSIBAA4.tmp-\ SFXCA: Binding to CLR version
v4.0.30319 Calling custom action
CustomActions!CustomActions.CustomActions.InitializeInstallationValues
Exception thrown by custom action:
System.Reflection.TargetInvocationException: Exception has been thrown
by the target of an invocation. ---> System.IO.FileLoadException:
Could not load file or assembly 'InstallerUtils, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null' or one of its dependencies.  Access is denied.
    at CustomActions.CustomActions.InitializeInstallationValues(Session session)          
    --- End of inner exception stack trace ---
    at System.RuntimeMethodHandle.InvokeMethod(Object target, Object arguments, Signature sig, Boolean constructor)
    at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object parameters, Object arguments)
    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture)   
    at Microsoft.Deployment.WindowsInstaller.CustomActionProxy.InvokeCustomAction(Int32sessionHandle, String entryPoint, IntPtr remotingDelegatePtr)
CustomAction InitializeProperties returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
由于MSI可以写入文件,但不能从中读取,在我看来,某种形式的安全软件/策略可能已经到位;是否有Windows API可以让我确定原因:

访问被拒绝


询问客户安装了哪些防病毒/恶意软件产品,并让他们将其禁用。重新测试以确认这是否是问题所在

如果这不起作用,请在谷歌上搜索“无法加载文件或程序集访问被拒绝”,并忽略任何涉及ASP.NET的线程。DTF不会编译到一个临时的internet文件目录,因此这与此无关。该计算机上的某些内容正在干扰加载所需程序集的过程

如果是一些wierd防病毒的东西,你可以尝试重建DLL,看看签名是否不再使扫描仪触发假警报。您也可以尝试对其进行代码签名


我曾在90年代的一个项目中工作过,其中一个IBM合作伙伴使用他们自己的IBM antivirus在运行我们的安装程序进行一个版本时遇到问题,而下一个版本就消失了。他们对我们发疯(我们是EDS,所以他们自然讨厌我们),说我们被愚弄了,但我们没有

让您的(预防)信息技术部门取消该用户计算机和/或帐户上的文件权限。“无法加载文件或程序集“InstallerUtils[…]”或其某个依赖项。访问被拒绝。”-因此可能缺少或无法访问某个依赖项。这不是我们的It,而是我们的一个客户端”。这只发生在一个客户身上;MSI可以在数百种其他环境中工作。我正试图以编程方式确定什么可能会锁定对该文件的访问,以便将该信息传递给用户。今天,我注意到有问题的.dll没有数字签名(它只是临时提取到目标PC)。我认为这可能是根本原因。仍在等待AV/安全软件的回复。我们的数字证书在相当长的一段时间内都不会刷新,因此如果它不喜欢签名,那么就没有什么可以做的了。同时让他们确保他们使用的是最新版本的Windows Installer。