속성 값을 C#으로 작성된 사용자 지정 작업에 보내야하는 다음 Wix 코드가 있습니다. 기본적으로 내가 원하는 것은 MSI가 설치되었을 때, Wix가 텍스트 파일에 프로그램을 설치 한 폴더의 경로를 쓰고 싶습니다. 나는 this 사이트를 참조하고 그에 따라 코드를 만들었지 만, 내 사용자 지정 작업이 작동하지 않습니다.텍스트에 Installfolder를 쓰는 Wix 사용자 지정 액션 구현
이using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Deployment.WindowsInstaller;
namespace SetupCAInstallFolder
{
public class CustomActions
{
[CustomAction]
public static ActionResult InstallFolderFinder(Session session)
{
session.Log("Here is the SetupCAInstallFolder");
string path = session["INSTALLEDPATH"];
session.Log("Installed Path is " + path);
System.IO.File.WriteAllText("F:\\pathgenerated.txt", path);
//System.IO.File.WriteAllText(path + "installed.txt", "sdkasdkasdlkasdk");
return ActionResult.Success;
}
}
}
윅스 파일을 컴파일하고 있습니다 : 나는 또한 가치를 얻을 및 파일에 쓰기로되어 내 C# 코드를 준
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="SetupInstallFolder" Language="1033" Version="1.0.0.0" Manufacturer="LP" UpgradeCode="9e10a7d8-4ffb-493c-8318-c44ba4bc0c4c">
<Package InstallerVersion="200" Compressed="no" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="SetupInstallFolder" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="SetupInstallFolder" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="SomeRandomEXE">
<File Source ="G:\SarVaGYa\myworkspace\LatestLpa\lpa\lpa_c\here\src\lpa\Release\lpa.exe" />
</Component>
</ComponentGroup>
<Binary Id="SetupCA2" src="G:\visual studio stuffs\SetupCAInstallFolder\SetupCAInstallFolder\bin\Release\SetupCAInstallFolder.CA.dll"/>
<CustomAction Id="INSTALLFOLDERFINDER" Execute="immediate" Property="INSTALLEDPATH" Value="[INSTALLFOLDER]" />
<InstallExecuteSequence>
<Custom Action="INSTALLFOLDERFINDER" Sequence="2"></Custom>
</InstallExecuteSequence>
</Fragment>
</Wix>
: 다음
내 윅스 파일입니다 INSTALLEDPATH 값을 얻지 못하는 MSI. DllEntry = "InstallFolderFinder"CustomAction 태그에을 추가하면 오류로 인해 실패합니다. CustomAction/@ DllEntry 특성은이 요소에서 이전에 지정한 특성과 공존 할 수 없습니다. DllEntry, 오류, ExeCommand, JScriptCall, 스크립트, 가치, 또는 VBScriptCall
가 어떻게 C# 사용자 지정 작업에 참고 InstalledPath의 값을 전달 수행하십시오에서 CustomAction 요소는 한 번에 지정된 다음 대상 속성 중 하나를 가질 수있다?
흥미 롭 군 -이 솔루션이 마음에 들었고 다른 사용자 지정 동작을 사용하여 UI 값을 기반으로 값을 설정하지는 않았습니다. 좋은. – Joe
내 대답에 대한 내 의견보기.이것은 연기 된 사용자 지정 작업 (다른 사용자가 지연된 CA를 필요로하는 경우)에 대한 좋은 예입니다. – Philm