2012-03-05 29 views
12

再一次我被困在一個問題中,那可能很容易解決。
我想擴展一個由WiX創建的設置,以便對已安裝程序的配置文件進行更改。爲了做到這一點,我創建了一個CustomAction。爲了能夠更改配置文件,我需要知道它的(安裝位置)在我的CustomAction中。因此,我嘗試將INSTALLLOCATION和文件名傳遞給我的CustomAction。這就是問題所在:CustomActionData - 屬性始終爲空,安裝程序會引發異常。WiX CustomActionData在被調用的CustomAction中是空的

我的CustomAction是一個C#DLL文件:DemoDatumErzeugen.CA.dll。它包含一個修改配置文件的方法DatumEintragen。我試圖以這種方式訪問​​數據:

string path = session.CustomActionData["LOCATION"]; 

這是拋出異常的地方。我只收到了德國的錯誤消息,但它說的是:The supplied key was not found in the dictionaryDer angegebene Schlüssel war nicht im Wörterbuch angegeben.)。

這是我嘗試如何通過從我的設置腳本屬性,以我的自定義操作:

<Binary Id="DemoDatumEinrichtenCA" SourceFile="DemoDatumErzeugen.CA.dll"/> 

<CustomAction Id="DemoDatum.SetProperty" Return="check" Property="DatumEintragen" Value="LOCATION=[INSTALLLOCATION];NAME=StrategieplanConfig.xml;"/> 
<CustomAction Id="DemoDatum" BinaryKey="DemoDatumEinrichtenCA" DllEntry="DatumEintragen" Execute="deferred" Return="check" HideTarget="no"/> 

<InstallExecuteSequence> 
    <Custom Action="DemoDatum.SetProperty" After="InstallFiles"/> 
    <Custom Action="DemoDatum" After="DemoDatum.SetProperty"/> 
</InstallExecuteSequence> 

我見過很多例子,其中有人做過同樣的方式,或者至少非常相似。我已經嘗試了很多東西,但似乎沒有什麼幫助像在<Custom Action="DemoDatum.SetProperty" After="InstallFiles"/>之後更改值。 CustomActionData始終爲零。
我檢查它:session.CustomActionData.Count
再次,我非常感謝任何幫助或提示,如果我做錯了什麼。

回答

17

Property屬性值DemoDatum.SetProperty應該等於Id延遲操作的屬性值。因此,請將屬性名稱更改爲DemoDatum,或將延遲操作的Id更改爲DatumEintragen

+0

確實!就是這樣。萬分感謝。很容易忽略。 – Skalli 2012-03-05 13:55:57

+0

@Yan Sklyarenko我在使用bootstraper應用程序創建的.exe的安裝過程中遇到了一個問題。你可以看看這個,並幫助我http://stackoverflow.com/questions/27151665/error-0x80070643-fatal-error -during安裝 - 威克斯 – user2725407 2014-11-26 15:34:22

相關問題