내 솔루 션에 2 개의 프로젝트가 있습니다.설정 프로젝트에 사용자 지정 작업을 추가하는 방법
1). 맞춤 액션 클래스 (맞춤 액션)
2).
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Microsoft.Deployment.WindowsInstaller;
namespace CustomAction
{
public class CustomActions
{
[CustomAction]
public static ActionResult CustomAction1(Session session)
{
File.Create(@"c:\installed.txt");
return ActionResult.Success;
}
}
}
Product.wxs : 윅스 설치 프로젝트 (TestSetup는)
에서 CustomAction 프로젝트 CustomAction.cs가 문제없이
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="TestSetup" Language="1033" Version="1.0.0.0" Manufacturer="SB2"
UpgradeCode="39d922d3-a3f5-4207-b905-124615dda25d">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes"/>
<Feature Id="ProductFeature" Title="TestSetup" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
<InstallExecuteSequence>
<Custom Action="CustomAction" Before="InstallFinalize" />
</InstallExecuteSequence>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="TestSetup" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="result.rtf">
<File Id="result.rtf" Source="result.rtf" KeyPath="yes" Checksum="yes" />
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<CustomAction Id='CustomAction' BinaryKey='CustomAction.CA' DllEntry='CustomAction' />
<Binary Id='CustomAction.CA' SourceFile='..\CustomAction\bin\Debug\CustomAction.CA.dll' />
</Fragment>
</Wix>
설치 프로젝트의 buils,하지만 난려고 할 때 실행하십시오. 오류 메시지가 나타납니다. "이 Windows Installer 패키지에 문제가 있습니다.이 설치를 완료하는 데 필요한 DLL을 실행할 수 없습니다. 지원 담당자 나 패키지 공급 업체에 문의하십시오."
잘못된 이진 소스 파일 값 때문이라고 생각합니다. 문제를 해결하는 방법을 보여 주시겠습니까?