是否有人在创建文件时遇到错误,其中自定义操作的临时提取路径被附加?
我有一个执行一些系统检查的托管自定义操作(使用 Microsoft.Deployment.WindowsInstaller 的 64 位 C# DLL)。它在延迟 CA 中写入一个 inf 样式的 key=value 文件。这里真的没有什么花哨的东西,只是一个 File.Create( FullPathToFile )。
但是当我尝试写入文件时,由于某种原因,CA 被提取到的临时目录被包含在内。
MSI (s) (3C:E4) [10:19:36:712]:您好,我是您的 64 位 Elevated 自定义操作服务器。
SFXCA:将自定义操作提取到临时目录:C:\Windows\Installer\MSIC451.tmp-\
SFXCA:绑定到 CLR 版本 v2.0.50727
System.IO.DirectoryNotFoundException:找不到路径“C:\Windows Installer\MSIC451.tmp-*C:\Program Files\Path 属性文件应写入* ”的一部分。在 System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
在 System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs , String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
at .....
托管 CA 使用流编写器的方式有什么奇怪的吗?