MSI 安装程序,64 位操作系统,写入 \windows\system32\inetsrv 文件夹

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1348217/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 13:03:42  来源:igfitidea点击:

MSI Installer, 64 bit OS, write to \windows\system32\inetsrv folder

windows64-bitwindows-installersyswow64

提问by aaaa bbbb

On Windows Server 2008 64-bit, I need an .msi installer file to write some files to \windows\system32\inetsrv folder. (The files are some XML Schema validation files, that C# XmlReaderSettings.Schema.Add() expects to be in that folder).

在 Windows Server 2008 64 位上,我需要一个 .msi 安装程序文件来将一些文件写入 \windows\system32\inetsrv 文件夹。(这些文件是一些 XML 架构验证文件,C# XmlReaderSettings.Schema.Add() 期望在该文件夹中)。

When the installer runs, the files end up in \windows\SysWOW64\inetsrv folder, not where they need to be.

当安装程序运行时,文件最终位于 \windows\SysWOW64\inetsrv 文件夹中,而不是它们需要的位置。

I attempted to have the installer then write to \windows\Sysnative folder, and the installer created a folder with that exact name, which I didn't expect to be possible. See this pagefor a good discussion on suppressing SysWOW64 redirection.

我试图让安装程序然后写入 \windows\Sysnative 文件夹,安装程序创建了一个具有该确切名称的文件夹,我没想到这是可能的。有关抑制 SysWOW64 重定向的详细讨论,请参阅此页面

How should I get the .msi to write my files to the \windows\system32\inetsrv folder on Windows 2008 64-bit?

我应该如何让 .msi 将我的文件写入 Windows 2008 64 位上的 \windows\system32\inetsrv 文件夹?

回答by i_am_jorf

Here are the system folder propertiesyou can use. I know it is counter-intuitive, but have you tried System64Folder? Read the remarks.

以下是您可以使用的系统文件夹属性。我知道这是违反直觉的,但是您是否尝试过System64Folder?阅读注释。

If that doesn't work, try just tacking System32 on to the end of WindowsFolder.

如果这不起作用,请尝试将 System32 附加到WindowsFolder的末尾。

Edit-1: Try setting the Win64 attribute on your Componentelement and see if the redirection behavior changes.

编辑 1:尝试在您的 Component元素设置Win64 属性并查看重定向行为是否发生变化。

回答by Alfa

I tried to use Sysnative in wxs file but I got the same result: create a Sysnative folder under Windows instead of using System32. So I used Sysnative in a vbscript CA: found the Windows folder (&H24&) and append \Sysnative. This works, but a second CA is needed to delete the files during uninstall.

我尝试在 wxs 文件中使用 Sysnative 但我得到了相同的结果:在 Windows 下创建一个 Sysnative 文件夹而不是使用 System32。所以我在 vbscript CA 中使用了 Sysnative:找到了 Windows 文件夹 (&H24&) 并附加了 \Sysnative。这有效,但需要第二个 CA 才能在卸载过程中删除文件。

回答by aaaa bbbb

I solved my problem by writing the files to \windows, rather than \windows\system32. It turns out that the C# XmlReaderSettings.Schema.Add() will work with a fully qualified path under the \windows directory. It just defaults to the system32 folder if the path supplied is not fully qualified.

我通过将文件写入 \windows 而不是 \windows\system32 解决了我的问题。事实证明,C# XmlReaderSettings.Schema.Add() 将使用 \windows 目录下的完全限定路径。如果提供的路径不是完全限定的,它只是默认为 system32 文件夹。

This isn't really an answer to the question, but it is a work-around for my immediate needs.

这并不是问题的真正答案,但它是满足我当前需求的一种解决方法。