2017-09-12 38 views
0

我遵循一個簡單的YouTube指令視頻介紹如何進行非常基本的WiX設置以創建msi文件。 目的是將某些文件放入特定目錄並創建4個註冊表項。我在VS 2015內置的安裝項目中做到了這一點,並取得了很好的效果。然而,WiX項目不起作用。這是我第一次使用XML。WiX Project VS 2015目錄未創建

例如,我在這裏所定義的目錄:

<Fragment> 
<Directory Id="ProgramFilesFolder" Name="Programfiles"> 
    <Directory Id="MSOFFICEFOLDER" Name="Microsoft Office"> 
     <Directory Id="OFFICE14FOLDER" Name="Office14" /> 
     <Directory Id="LIBRARY" Name="Library"> 
     <Directory Id="MAKRO" Name="Makro">     
     </Directory> 
     </Directory> 
    </Directory> 
     </Directory> 
</Fragment> 

在這裏,我把文件放進文件夾:

<!-- Adding files to Office14 folders --> 
<Fragment> 
    <DirectoryRef Id="OFFICE14FOLDER"> 
    <Component Id="umrch.hlp" Guid="*"> 
     <File Id="umrch.hlp" Source="MySourceFiles\UMRCH.HLP" KeyPath="yes" 
Checksum="yes"/> 
    </Component> 
    </DirectoryRef> 

    <DirectoryRef Id="LIBRARY"> 
    <Component Id="umrch.xla" Guid="*"> 
     <File Id="umrch.xla" Source="MySourceFiles\umrch.xla" KeyPath="yes" 
Checksum="yes"/> 
    </Component> 
    </DirectoryRef> 

    <DirectoryRef Id="MAKRO"> 
    <Component Id="umrch.xla" Guid="*"> 
     <File Id="umrch.xla" Source="MySourceFiles\umrch.xla" KeyPath="yes" 
Checksum="yes"/> 
    </Component> 
    </DirectoryRef> 


    <!-- Adding files to Company folders--> 
    <DirectoryRef Id="DATA"> 
    <Component Id="DATAfiles" Guid="*"> 
     <File Id="defumrch.dat" Source="MySourceFiles\defumrch.dat" 
KeyPath="yes" Checksum="yes"/> 
     <File Id="LL_UMRCH.DAT" Source="MySourceFiles\LL_UMRCH.DAT" 
KeyPath="no" Checksum="yes"/> 
    </Component> 
    </DirectoryRef> 

    <DirectoryRef Id="VERSION"> 
    <Component Id="VERSIONfiles" Guid="*"> 
     <File Id="umrch_Readme.doc" Source="MySourceFiles\umrch_Readme.doc" 
KeyPath="yes" Checksum="yes"/> 
     <File Id="umrch_Version.txt" Source="MySourceFiles\umrch_Version.txt" 
KeyPath="no" Checksum="yes"/> 
    </Component> 
    </DirectoryRef> 


    <!-- Adding files to Windows folder--> 
    <DirectoryRef Id="WindowsFolder"> 
    <Component Id="WINDOWSfiles" Guid=""> 
    <File Id="umrch.dll" Source="MySourceFiles\umrch.dll" KeyPath="yes" 
Checksum="yes"/> 
     <File Id="umrch.lib" Source="MySourceFiles\umrch.lib" KeyPath="no" 
Checksum="yes"/> 
     <File Id="umrch.mif" Source="MySourceFiles\umrch.mif" KeyPath="no" 
Checksum="yes"/> 
    </Component> 
    </DirectoryRef> 
</Fragment> 

在這裏,他們應該安裝:

<Fragment> 
    <!-- Tell WiX to install the files --> 
    <Feature Id="xlahelp" Title="XLA and help files" Level="1"> 
    <ComponentRef Id="umrch.hlp" /> 
    <ComponentRef Id="umrch.xla" /> 
    </Feature> 

    <Feature Id="COMPANYfiles" Title="Company files" Level="1"> 
    <ComponentRef Id="DATAfiles" /> 
    <ComponentRef Id="VERSIONfiles" /> 
    </Feature> 

    <Feature Id="WindowsFiles" Title="Windows files" Level="1"> 
    <ComponentRef Id="WINDOWSfiles" /> 
    </Feature> 

    <Feature Id="Registry" Title="umrch" Level="1"> 
    <ComponentGroupRef Id="Registry"/> 
    </Feature> 
</Fragment> 

是否有一些引用丟失或者我錯誤地使用了XML?

編輯:這是產品威克斯

<Product Id="*" Name="UMRCH" Language="1033" Version="1.0.0.0" Manufacturer="Sample" UpgradeCode="ee45fb60-6741-4424-8136-dfc0d679629a"> 
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> 

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> 
    <MediaTemplate /> 


</Product> 

編輯爲斯坦Åsmul:

DATA和版本應該是這裏定義:

<Fragment> 
<Directory Id="WindowsVolume" Name="WindowsVolume"> 
    <Directory Id="!(bind.property.Manufacturer)" Name="!(bind.property.Manufacturer)"> 
    <Directory Id="UMRCH" Name="!(bind.property.ProductName)" /> 
     <Directory Id="DATA" Name="data"> 
     <Directory Id="VERSION" Name="version" /> 
     </Directory> 
    </Directory> 
    </Directory> 

它也不會編譯當使用WiX時。 .msi文件的構建沒有發生任何錯誤。 當用SuperOrca打開它時,它顯示一個選項卡_Validation,因爲我對此很新,我不知道如何閱讀Orca中的.msi。

我現在還添加了github以獲得更好的可見性。

Product/Registry

+0

你能提供定義你的''的wxs嗎?如果你沒有正確地引用你所做的這些片段(最終在''中被引用),所有的東西都會在編譯時被丟棄。 –

+0

我更新了我的原始帖子! – coltfinger

+0

最好只顯示整個WiX源代碼,以便它可以簡單地複製和粘貼以供其他人重現。 – PhilDW

回答

0

是否使用維克斯時,該文件編譯呢?它看起來像你還沒有定義你安裝到的一些目錄。例如DATA和VERSION。如果你得到一個輸出MSI文件,當你用Orca打開它時,它看起來是什麼樣的?你有沒有在MSI上運行驗證?

一旦你更新了你的問題和更多的細節,我會「發展」這個答案。讓我們儘量減少評論的使用「討論」。

+0

我更新了我原來的帖子! – coltfinger