1. C# > Windows Form 프로젝트 선택
2. 참조에 Microsoft.WindowsLive.PublishPlugins 라이브러리 추가 (Program Files 내 live 설치 폴더에 dll 추가)
3. 프로젝트 > 설정 > 응용프로그램 > 출력 형식 > 클래스 라이브러리로 변경
4. wxs 파일 생성(wix 프로그램 설치 필요) - 설치 패키지 프로그램
- 최소 설정
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="
http://schemas.microsoft.com/wix/2006/wi">
<?define File_Name='test1.dll' ?>
<?define Product_Name='test' ?>
<?define RegistryKey_ClassName='test1.PublishPlugin' ?>
<?define Component_Guid='D11E3C5F-0451-4e8a-BB2E-8B66AA07A37F' ?>
<Product Id="677a7ac3-6e9b-4531-8a61-c31acc301d27" Name="Test" Language="1033" Version="1.0.0.0" Manufacturer="Test" UpgradeCode="ae949a2b-1fcd-4abe-bf47-1eb923575de1">
<Package InstallerVersion="200" Compressed="yes" />
<Property Id='ALLUSERS' Value='1' />
<!-- 아이콘 설정인듯 -->
<Icon Id='MyIcon' SourceFile='$(var.dllpath)\$(var.File_Name)' />
<Property Id='ARPPRODUCTICON' Secure='yes' Value='MyIcon' />
<!-- 프레임워크 세팅-->
<PropertyRef Id="NETFRAMEWORK20"/>
<Condition Message="Windows Live Photo Gallery plug-ins require the .NET Framework 2.0 or higher. Please download and install the latest version from
http://www.microsoft.com/net/DownloadCurrent.aspx">
Installed OR NETFRAMEWORK20
</Condition>
<Media Id="1" Cabinet="MySetup.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name='PFiles'>
<Directory Id="INSTALLLOCATION" Name="Test">
<Component Id="ProductComponent" Guid='$(var.Component_Guid)'>
<File Id="PluginDLL" Name="$(var.File_Name)" Source="$(var.dllpath)\$(var.File_Name)" DiskId="1" Vital='yes' />
<RegistryKey Root='HKLM' Key='Software\Microsoft\Windows Live\PublishPlugins' Action='create'>
<RegistryKey Key='$(var.Product_Name)' Action='createAndRemoveOnUninstall'>
<RegistryValue Name='AssemblyPath' Type='string' Value='[INSTALLLOCATION]$(var.File_Name)'/>
<RegistryValue Name='ClassName' Type='string' Value='$(var.RegistryKey_ClassName)'/>
<RegistryValue Name='FriendlyName' Type='string' Value='$(var.Product_Name)'/>
<RegistryValue Name='IconPath' Type='string' Value='[INSTALLLOCATION]$(var.File_Name),-32512'/>
</RegistryKey>
</RegistryKey>
</Component>
</Directory>
</Directory>
</Directory>
<!-- 설치페이지인듯 -->
<Feature Id="ProductFeature" Title="test" Level="1" Description='The complete package' ConfigurableDirectory='INSTALLLOCATION'>
<ComponentRef Id="ProductComponent" />
</Feature>
</Product>
</Wix>
5. 프로젝트 > 설정 > 빌드 이벤트 > 빌드 후 이벤트 명령어 줄 에 패키지 생성 스크립트 추가
"$(ProgramFiles)\Windows Installer XML v3\bin\candle.exe" -nologo -ddllpath=. -dsetuppath=Setup "$(ProjectDir)\test.wxs"
"$(ProgramFiles)\Windows Installer XML v3\bin\light.exe" -nologo -ext WixUIExtension -ext WixNetFxExtension test.wixobj -cultures:en-us
6. 빌드 후 생성 파일을 설치
6. 디버그는 해당 dll 위치에 디버그 위치를 변경
7. IPublishPlugin를 상속받는 클래스 생성
8. ShowConfigurationSettings 메소드내 생성된 form을 생성
public class PublishPlugin : IPublishPlugin
{
....................
public bool ShowConfigurationSettings(IWin32Window parentWindow, XmlDocument sessionXml, XmlDocument persistXml, IPublishProperties publishProperties)
{
// Show the configuration dialog to the user and return the result.
return Form1.GetSessionInfo(parentWindow, sessionXml, persistXml);
}
9. 해당 form내 Show를 시켜주는 로직 추가
public partial class Form1 : Form
{
public static bool GetSessionInfo(IWin32Window parent, XmlDocument sessionXml, XmlDocument persistXml)
{
Form1 pf = new Form1();
pf.sessionXml = sessionXml;
pf.persistXml = persistXml;
return pf.ShowDialog(parent) == DialogResult.OK;
}