2013-03-19 35 views
6

Cドライブにフォルダを作成し、wixインストーラプログラムでそのフォルダ内にいくつかのサブフォルダを作成します。しかし、これらのフォルダはインストールされたフォルダとは関係ありません。 。私のプログラムはAServiceSetupフォルダ内にインストールしたいのですが、Cドライブ内に 'PTLogFile'フォルダを作成し、そのフォルダ内にいくつかのサブフォルダを作成したいと考えています。いずれも私のcode.Followingを修正するために私を助けてください、あなたがディレクトリ構造を定義しているが、私のコードwixでフォルダを作成する

<Directory Id="TARGETDIR" Name="SourceDir"> 

    <Directory Id="PTLogFile" Name="PTLogFile"> 
    <Directory Id="Backups" Name="Backups"/> 
    <Directory Id="CommandLog" Name="CommandLog"/> 
    <Directory Id="EventLog" Name="EventLog"/> 
    <Directory Id="Responds" Name="Responds"/> 
    </Directory> 
     <Directory Id="ProgramFilesFolder"> 
      <Directory Id="INSTALLFOLDER" Name="AServiceSetup"> 
     </Directory> 
     </Directory> 

    </Directory> 
</Fragment>     

答えて

11

あなたの返信ありがとうございます。

<Directory Id="TARGETDIR" Name="SourceDir"> 
    <Directory Id="LogFile" Name="LogFile"> 
    <Directory Id="Logs" Name="Logs"> 
     <Directory Id="Log1" Name="Log1"/> 
     <Directory Id="Log2" Name="Log2"/> 
     <Directory Id="Log3" Name="Log3"/> 
     <Directory Id="Log4" Name="Log4"/> 
    </Directory> 
    </Directory> 
    <Directory Id="ProgramFilesFolder"> 
    <Directory Id="INSTALLFOLDER" Name="AServiceSetup"> 
    </Directory> 
    </Directory> 
</Directory> 

とコンポーネントを次のように

<ComponentRef Id="CreateLogFolders"/> 

を次のように

<Component Id="CreateLogFolders" Guid="....." Directory="LogFile" > 
    <CreateFolder Directory="LogFile" /> 
    <CreateFolder Directory="Logs"/> 
    <CreateFolder Directory="Log1"/> 
    <CreateFolder Directory="Log2"/> 
    <CreateFolder Directory="Log3"/> 
    <CreateFolder Directory="Log4"/> 
</Component> 

、製品の機能内でこのコンポーネントの参照を次のように私は上記の回答から ディレクトリ構造を答えを得ました最後に、次のように製品内にプロパティを追加します。

<Property Id="LogFile" Value="C:" /> 
4

で、インストーラはコンポーネントのみが必要とするディレクトリを作成しようとしています。

簡単なオプションは、次のようなコンポーネントを追加することです:

<Component Id="CreateLogFolders" Directory="PTLogFile"> 
    <CreateFolder Directory="PTLogFile" /> 
    <CreateFolder Directory="Backups" /> 
    <CreateFolder Directory="CommandLog" /> 
    <CreateFolder Directory="EventLog" /> 
    <CreateFolder Directory="Responds" /> 
</Component> 

と参照あなたの機能の一つで、このコンポーネント。

+0

をあなたの素早い返信をありがとう...しかし、私は次のようなエラーがあります。エラー ICE18:コンポーネントのKeyPath: 'CreateLogFolders'はディレクトリです: 'PTLogFile'。ディレクトリ/コンポーネントのペアは、CreateFoldersテーブルにリストされている必要があります。 – Programmer

+0

ああ、更新されました。 – ChrisPatrick

+0

まだ同じエラーが残っています。以下のコードを参照してください... <コンポーネントID = "CreateLogFolders"ディレクトリ= "PTLogFile" Guid = "2F15F916-2EEF-4F62-AE23-BC2882A9E12E"> あなたが追加する必要があり – Programmer

1

<CreateFolder>要素は、それぞれ独自のコンポーネント内にCreateFolder tableというレコードになります。そうでなければ、私は

...これは component rulesとよく準拠わからないんだけど、次のようなディレクトリ構造を残す:

<Directory Id="TARGETDIR" Name="SourceDir"> 
    <Directory Id="PTLogFile" Name="PTLogFile" /> 
    <Directory Id="ProgramFilesFolder"> 
    <Directory Id="INSTALLFOLDER" Name="AServiceSetup"> 
    </Directory> 
</Directory> 

そして、これと同様の方法でコンポーネント著者:

<DirectoryRef Id="PTLogFile"> 
    <Directory Id="Backups"> 
    <Component Id="..." Guid="..."> 
     <CreateFolder /> 
    </Component> 
    </Directory> 
    <Directory Id="CommandLog"> 
    <Component Id="..." Guid="..."> 
     <CreateFolder /> 
    </Component> 
    </Directory> 
    <Directory Id="EventLog"> 
    <Component Id="..." Guid="..."> 
     <CreateFolder /> 
    </Component> 
    </Directory> 
    <Directory Id="Responds"> 
    <Component Id="..." Guid="..."> 
     <CreateFolder /> 
    </Component> 
    </Directory> 
</DirectoryRef> 
+0

私はそれがフォルダであり、実際のリソースではないので、この場合の問題ではないと思います。彼らが意味論的に一つのことであるのは、まったく、あるいはまったくないケースです。 – ChrisPatrick

+0

コンポーネントのルールを除き、フォルダの作成ではコンポーネントのコレクションが永遠に出荷されなければならないと言います。コンポーネントからコンポーネントを追加または削除することはできません。フォルダは、直接作成されたときのリソースです。 –

+0

公正なポイント、私はまだそれがその変更を行う必要がある可能性があるかわからない... – ChrisPatrick

関連する問題