像这样的东西:
<Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="ProgramFilesFolder"> <Directory Id="Myvendor" Name="Myvendor"> <Directory Id="INSTALLDIR" Name="MyDir"> <Component Id="MyFileId" Guid="...G1..."> <File Id="MyFileId" Name="MyFile" Source="...blabla...\MyFile" KeyPath="yes" > </File> </Component> <DirectoryRef Id="TARGETDIR"> <Component Id="MyFilecopyId" Guid="...G2..."> <RemoveFile Id="MyFileRemoveId" Name="MyFile" On="install" Directory="MycopyDir" /> <copyFile Id="MyFilecopyId" FileId="MyFileId" DestinationDirectory="MycopyDir" /> </Component> <Feature Id="MyFeature" ... > <ComponentRef Id="MyFileId" /> <ComponentRef Id="MyFilecopyId" />
重要的Xml元素是copyFile.您需要创建一个新组件,它是第一个组件的副本(当然,具有不同的ID,guids,…).两个组件都需要在功能中声明.