使用 WiX,如何更改虚拟目录的子文件夹的属性?

发布于 2024-09-03 07:10:23 字数 574 浏览 4 评论 0 原文

我在 WiX 脚本中有一个目录元素的层次结构。

我还有一个创建虚拟目录的组件(使用 IIS:WebVirtualDir),它指向我的目录层次结构的根。

如何更改虚拟目录的子文件夹的属性(例如 AnonymousAccess),例如

MyVirtualDir <<<这是虚拟目录根

MyVirtualDir\MySubFolder <<<这是我希望使用 WebDirProperties 更改其属性的子文件夹。

请注意,我希望为该子文件夹创建新的虚拟目录。我只想更改一些安全设置。

当前的脚本太大,无法在此处发布,但请查看 WiX 教程: 5.3 Web 目录。假设在该示例中,有另一个名为“MySubFolder”的 Directory 元素嵌套在“InstallDir”元素中。那么,为了设置“MySubFolder”的属性而不将其转换为虚拟目录,下一步是什么?

I have a hierarchy of Directory elements in a WiX script.

I also have a component that creates a virtual directory (using IIS:WebVirtualDir), which points to the root of my Directory hierarchy.

How do I change a property (e.g. AnonymousAccess) of a subfolder of the virtual directory, e.g.

MyVirtualDir <<< this is the virtual directory root

MyVirtualDir\MySubFolder <<< this is the subfolder for which I wish to change a property using WebDirProperties

Please note that I do not wish to create a new virtual directory for the subfolder. I only wish to change a few security settings.

The current script is too big to post here, but take a look at the WiX tutorial: 5.3 Web Directory. Suppose in that example that there was another Directory element named "MySubFolder" nested within the "InstallDir" element. What would then be the next step in order to set properties for "MySubFolder" without turning it into a virtual directory?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鱼窥荷 2024-09-10 07:10:23

IIS:Web 元素的示例代码似乎很难获得,但经过一番尝试和错误,我想我找到了一个解决方案:

在目录层次结构中正常创建文件夹:

<Directory Id='blahDir' Name='blah'>
    <Component Id ='CreateBlah' Guid='B1976E1A-DEB1-4FBB-A5AB-4AA60930D2DC'>
        <CreateFolder />
    </Component>
</Directory>

创建一个 IIS:WebDirProperties 元素(在本例中) ,一些用于测试的随机值):

<IIS:WebDirProperties Id="ReadAndExecute" Read="yes" Write="yes" Script="yes" Execute="yes" AnonymousAccess="yes" Index="no" LogVisits="no" />

创建一个指向文件夹和 WebDirProperties 元素的 IIS:WebDir 组件:

<Component Id='TestWebDir' Guid='8ED05357-1AAE-49F2-8C66-8813583C8157'>
    <IIS:WebDir WebSite='DefaultWebSite' Id='MyWebDir' Path='Test/blah' DirProperties='ReadAndExecute' />
</Component>

改编自 WiX 教程的整个示例可以在下面找到:

<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:IIS="http://schemas.microsoft.com/wix/IIsExtension">
    <Product Name='Foobar 1.0' Id='48A3DF7A-E1C3-48BE-91D9-4D7368740A78' UpgradeCode='F8ABBBC9-0696-4FA9-A0DC-C9368E858A76'
      Language='1033' Codepage='1252' Version='1.0.0' Manufacturer='Acme Ltd.'>

        <Package Id='*' Keywords='Installer'
          Description="Acme's Foobar 1.0 Installer"
          Comments='Foobar is a registered trademark of Acme Ltd.' Manufacturer='Acme Ltd.'
          InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />

        <Icon Id="AddRemoveProgram.ico" SourceFile="AddRemoveProgram.ico" />
        <Property Id="ARPPRODUCTICON" Value="AddRemoveProgram.ico" />

        <Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" />
        <Property Id='DiskPrompt' Value="Acme's Foobar 1.0 Installation [1]" />

        <Directory Id='TARGETDIR' Name='SourceDir'>
            <Directory Id='ProgramFilesFolder' Name='PFiles'>
                <Directory Id='InstallDir' Name='Acme'>

                    <Directory Id='blahDir' Name='blah'>
                        <Component Id ='CreateBlah' Guid='B1976E1A-DEB1-4FBB-A5AB-4AA60930D2DC'>
                            <CreateFolder />
                        </Component>
                    </Directory>

                    <Component Id='default.htmlComponent' Guid='E2FC2FC2-96A2-4BE5-BBCB-7184D9AAACA0'>
                        <File Id='default.htmFile' Name='default.htm' KeyPath='yes' DiskId='1' Source='default.htm' />
                    </Component>

                </Directory>
            </Directory>

            <Component Id='TestWebVirtualDirComponent' Guid='B4E73F80-875C-487A-BC57-A568732F03A3'>
                <IIS:WebVirtualDir Id='TestWebVirtualDir' Alias='Test' Directory='InstallDir' WebSite='DefaultWebSite'>
                    <IIS:WebApplication Id='TestWebApplication' Name='Test' />
                </IIS:WebVirtualDir>
            </Component>

            <Component Id='TestWebDir' Guid='8ED05357-1AAE-49F2-8C66-8813583C8157'>
                <IIS:WebDir WebSite='DefaultWebSite' Id='MyWebDir' Path='Test/blah' DirProperties='ReadAndExecute' />
            </Component>

        </Directory>

        <IIS:WebSite Id='DefaultWebSite' Description='Default Web Site'>
            <IIS:WebAddress Id='AllUnassigned' Port='80' />
        </IIS:WebSite>

        <Feature Id='TestFeature' Title='TestFeature' Level='1'>
            <ComponentRef Id='CreateBlah'/>
            <ComponentRef Id='default.htmlComponent' />
            <ComponentRef Id='TestWebDir'/>
            <ComponentRef Id='TestWebVirtualDirComponent' />
        </Feature>

        <IIS:WebDirProperties Id="ReadAndExecute" Read="yes" Write="yes" Script="yes" Execute="yes" AnonymousAccess="yes" Index="no" LogVisits="no" />

    </Product>
</Wix>

Sample code for the IIS:Web element seems to be hard to come by, but after some trial and error, I think I found a solution:

Create the folder as normal in the Directory hierarchy:

<Directory Id='blahDir' Name='blah'>
    <Component Id ='CreateBlah' Guid='B1976E1A-DEB1-4FBB-A5AB-4AA60930D2DC'>
        <CreateFolder />
    </Component>
</Directory>

Create an IIS:WebDirProperties element (in this case, some random values for testing):

<IIS:WebDirProperties Id="ReadAndExecute" Read="yes" Write="yes" Script="yes" Execute="yes" AnonymousAccess="yes" Index="no" LogVisits="no" />

Create an IIS:WebDir component pointing to the folder and the WebDirProperties element:

<Component Id='TestWebDir' Guid='8ED05357-1AAE-49F2-8C66-8813583C8157'>
    <IIS:WebDir WebSite='DefaultWebSite' Id='MyWebDir' Path='Test/blah' DirProperties='ReadAndExecute' />
</Component>

The entire sample, adapted from the WiX tutorial, can be found below:

<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:IIS="http://schemas.microsoft.com/wix/IIsExtension">
    <Product Name='Foobar 1.0' Id='48A3DF7A-E1C3-48BE-91D9-4D7368740A78' UpgradeCode='F8ABBBC9-0696-4FA9-A0DC-C9368E858A76'
      Language='1033' Codepage='1252' Version='1.0.0' Manufacturer='Acme Ltd.'>

        <Package Id='*' Keywords='Installer'
          Description="Acme's Foobar 1.0 Installer"
          Comments='Foobar is a registered trademark of Acme Ltd.' Manufacturer='Acme Ltd.'
          InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />

        <Icon Id="AddRemoveProgram.ico" SourceFile="AddRemoveProgram.ico" />
        <Property Id="ARPPRODUCTICON" Value="AddRemoveProgram.ico" />

        <Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" />
        <Property Id='DiskPrompt' Value="Acme's Foobar 1.0 Installation [1]" />

        <Directory Id='TARGETDIR' Name='SourceDir'>
            <Directory Id='ProgramFilesFolder' Name='PFiles'>
                <Directory Id='InstallDir' Name='Acme'>

                    <Directory Id='blahDir' Name='blah'>
                        <Component Id ='CreateBlah' Guid='B1976E1A-DEB1-4FBB-A5AB-4AA60930D2DC'>
                            <CreateFolder />
                        </Component>
                    </Directory>

                    <Component Id='default.htmlComponent' Guid='E2FC2FC2-96A2-4BE5-BBCB-7184D9AAACA0'>
                        <File Id='default.htmFile' Name='default.htm' KeyPath='yes' DiskId='1' Source='default.htm' />
                    </Component>

                </Directory>
            </Directory>

            <Component Id='TestWebVirtualDirComponent' Guid='B4E73F80-875C-487A-BC57-A568732F03A3'>
                <IIS:WebVirtualDir Id='TestWebVirtualDir' Alias='Test' Directory='InstallDir' WebSite='DefaultWebSite'>
                    <IIS:WebApplication Id='TestWebApplication' Name='Test' />
                </IIS:WebVirtualDir>
            </Component>

            <Component Id='TestWebDir' Guid='8ED05357-1AAE-49F2-8C66-8813583C8157'>
                <IIS:WebDir WebSite='DefaultWebSite' Id='MyWebDir' Path='Test/blah' DirProperties='ReadAndExecute' />
            </Component>

        </Directory>

        <IIS:WebSite Id='DefaultWebSite' Description='Default Web Site'>
            <IIS:WebAddress Id='AllUnassigned' Port='80' />
        </IIS:WebSite>

        <Feature Id='TestFeature' Title='TestFeature' Level='1'>
            <ComponentRef Id='CreateBlah'/>
            <ComponentRef Id='default.htmlComponent' />
            <ComponentRef Id='TestWebDir'/>
            <ComponentRef Id='TestWebVirtualDirComponent' />
        </Feature>

        <IIS:WebDirProperties Id="ReadAndExecute" Read="yes" Write="yes" Script="yes" Execute="yes" AnonymousAccess="yes" Index="no" LogVisits="no" />

    </Product>
</Wix>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文