Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
556 views
in Technique[技术] by (71.8m points)

installation - How to create a directory in wix?

My requirement is to create a directory in programdata/test/example. How can I do that in wix?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Define the folder like this:

<Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="CommonAppDataFolder">
        <Directory Id="TestFolder" Name="test">
            <Directory Id="ExampleFolder" Name="example" />
        </Directory>
    </Directory>
</Directory>

The important part here is the CommonAppDataFolder Id, which is known by Windows installer. You can find the full list of known system folders in the Windows Installer Property Reference.

If you install any files to that folder, it will be created implicitly. If not, you can force it to be created by installing a component like this:

<Component Id="CreateTestFolder" Directory="ExampleFolder" Guid="PUT-RANDOM-GUID-HERE">
    <CreateFolder />
</Component>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...