2014-04-23 3 views
1

InstallScript와 관련하여 몇 가지 문제가있어 잘 모르겠습니다. 메인 하나는 내가 machine.config 파일에 다음을 추가 할 필요가 있다는 것입니다 :InstallScript 및 machine.config

<system.transactions> 
    <machineSettings maxTimeout="02:00:00" /> 
</system.transactions> 

하지만 같은를 추가하고있다 : 여기

<system.transactions> 
    <machineSettings> 
     <maxTimeout>"02:00:00"</maxTimeout> 
    </machineSettings> 
</system.transactions> 

내가 업데이트 사용하고 코드입니다 파일 (메시지 상자는 디버깅 용입니다).

function STRING GetMachineConfigPath(hMSI) 
    STRING strRetVal; 
    NUMBER nSize, nType; 
begin 
    nSize = MAX_PATH - 1; 
    MsiGetProperty(ISMSI_HANDLE, "MACHINECONFIGPATH", strRetVal, nSize); 
    return strRetVal; 
end; 

function SaveMachineConfigSettings(hMSI) 
    OBJECT oDoc; // XML Document object 
    OBJECT oNode; // A node in the XML DOM tree 
    OBJECT CurrParent; // Current parent node 
    STRING szFilename; 
    BOOL successfulLoad; 
begin 

    szFilename = GetMachineConfigPath(hMSI) + "config\\machine.config"; 

    if Is(FILE_EXISTS, szFilename) = FALSE then 
     MessageBox("Could not find machine.config file.", 0); 
     return -1; 
    endif; 

    set oDoc = CreateObject("Msxml2.DOMDocument"); 
    if (IsObject(oDoc) = FALSE) then 
     MessageBox("Could not open machine.config file.", 0); 
     return -1; 
    endif; 

    oDoc.Async = FALSE; 
    oDoc.setProperty("SelectionLanguage", "XPath"); 

    successfulLoad = oDoc.load(szFilename); 
    MessageBox("File loaded successfully.", 0); 

    if (successfulLoad = FALSE) then 
     MessageBox("File did not load successfully.", 0); 
     return -1; 
    endif; 

    set CurrParent = oDoc.documentElement; 
    set oNode = AddSetting(oDoc, CurrParent, "system.transactions", ""); 
    set CurrParent = oNode; 
    set oNode = AddSetting(oDoc, CurrParent, "machineSettings", ""); 
    set CurrParent = oNode; 
    set oNode = AddSetting(oDoc, CurrParent, "maxTimeout", '"02:00:00"'); 

    // Write the XML document to a file. 
    oDoc.save(szFilename); 

    MessageBox("File updated successfully.", 0); 

    set oNode = NOTHING; 
    set oDoc = NOTHING; 

    return 0; 
end; 

function OBJECT AddSetting(oDoc, oParent, szNodeName, szValue) 
    OBJECT oNode; 
begin 
    // Add a carriage return & line feed to make the output easier to read. 
    set oNode = oDoc.createTextNode("\n"); 
    oParent.appendChild(oNode); 

    // Create the new setting node and value. 
    set oNode = oDoc.createElement(szNodeName); 
    oNode.text = szValue; 
    oParent.appendChild(oNode); 

    MessageBox("Node created successfully.", 0); 

    return oNode; 
end; 

제공 할 수있는 도움은 정말 감사하겠습니다.

+0

파일을 수정 한 다음 InstallShield 설치에서 해당 EXE를 실행하는 C# 콘솔 응용 프로그램을 만들었습니다. 이렇게하면 문제를 일으키는 것을 피하기 위해 파일 수정에 대한 유연성과 제어력이 향상되었습니다. – JTMoney1996

+0

문제를 어떻게 해결했는지 (메모가 아닌) 자기 소개로 받아 들여야한다는 것을 기억해야합니다. 그렇지 않으면이 질문에 답이없는 것처럼 보입니다. – J0e3gan

+1

답변을 추가했습니다. 죄송합니다. – JTMoney1996

답변

0

파일을 수정 한 다음 InstallShield 설치에서 해당 EXE를 실행하기 위해 C# 콘솔 응용 프로그램을 만들었습니다. 이로 인해 문제의 발생을 피하기 위해 파일 수정에 대한 유연성과 제어력이 향상되었습니다.