사용자 지정 XML 예
참고
이 항목의 표는 넓기 때문에 창의 너비를 조정해야 할 수도 있습니다.
이 항목의 내용
예 1: 지원되지 않는 응용 프로그램 마이그레이션
예 2: 내 비디오 폴더 마이그레이션
예 3: 파일 및 레지스트리 키 마이그레이션
예 4: 여러 위치에서 특정 폴더 마이그레이션
예 1: 지원되지 않는 응용 프로그램 마이그레이션
다음은 응용 프로그램을 마이그레이션하는 데 필요한 섹션에 대한 템플릿입니다. 템플릿 자체는 작동하지 않지만 사용자 .xml 파일을 작성하는 데 사용할 수 있습니다.
<migration urlid="https://www.microsoft.com/migration/1.0/migxmlext/migtestapp">
<component type="Application">
<!-- Name of the application -->
<displayName>Some Application</displayName>
<!-- Specify whether the environment variables exist in the context of user or system or both -->
<environment context="System">
<!-- Create the environment variables -->
<variable name="myVar1">
<!-- Simple text value assignment to a variable -->
<text>value</text>
</variable>
<variable name="myAppExePath">
<!-- Make a call to in-built helper function to get a value from a reg key and assign that value to the variable -->
<script>MigXMLHelper.GetStringContent("Registry","HKLM\Software\MyApp\Installer [EXEPATH]")</script>
</variable>
</environment>
<role role="Settings">
<detects>
<!-- All of these checks must be true for the component to be detected -->
<detect>
<!-- Make a call to in-built helper function to check if an object exists or not -->
<condition>MigXMLHelper.DoesObjectExist("Registry","HKLM\Software\MyApp [win32_version]")</condition>
</detect>
<detect>
<!-- Either of these checks must be true for the component to be detected -->
<!-- Make a call to in-built helper function to check if a file version matches or not -->
<condition>MigXMLHelper.DoesFileVersionMatch("%MyAppExePath%","ProductVersion","8.*")</condition>
<condition>MigXMLHelper.DoesFileVersionMatch("%MyAppExePath%","ProductVersion","9.*")</condition>
</detect>
</detects>
<!-- Describe the rules that will be executed during migration of this component and the context, whether user, system or both -->
<rules context="User">
<!-- Delete objects specified in the object set on the destination computer before applying source objects -->
<destinationCleanup>
<!-- Describe the pattern for the list of objects to be deleted -->
<objectSet>
<pattern type="Registry">HKCU\Software\MyApp\Toolbar\* [*]</pattern>
<pattern type="Registry">HKCU\Software\MyApp\ListView\* [*]</pattern>
<pattern type="Registry">HKCU\Software\MyApp [ShowTips]</pattern>
</objectSet>
</destinationCleanup>
<!-- Specify which set of objects should be migrated -->
<include>
<!-- Describe the pattern for the list of objects to be included -->
<objectSet>
<pattern type="Registry">HKCU\Software\MyApp\Toolbar\* [*]</pattern>
<pattern type="Registry">HKCU\Software\MyApp\ListView\* [*]</pattern>
<pattern type="Registry">HKCU\Software\MyApp [ShowTips]</pattern>
</objectSet>
</include>
<!-- Specify which set of objects should not be migrated -->
<exclude>
<!-- Describe the pattern for the list of objects to be excluded from migration -->
<objectSet>
<pattern type="Registry">HKCU\Software\MyApp [Display]</pattern>
</objectSet>
</exclude>
</rules>
</role>
</component>
</migration>
예 2: 내 비디오 폴더 마이그레이션
다음은 원본 컴퓨터에 내 비디오 폴더가 있는 경우 모든 사용자에 대해 해당 폴더를 마이그레이션하는 사용자 지정 .xml 파일입니다. 파일 이름은 CustomFile.xml입니다.
코드 | 동작 |
---|---|
|
원본 컴퓨터에 내 비디오가 있는지 확인합니다. |
|
대상 컴퓨터에서 확인되지 않는 내 비디오의 바로 가기를 필터링합니다. 바로 가기가 없는 파일에는 적용되지 않습니다. 예를 들어 원본 컴퓨터의 내 비디오에 C:\Folder1을 가리키는 바로 가기가 있는 경우 이 바로 가기는 대상 컴퓨터에 C:\Folder1이 있는 경우에만 마이그레이션됩니다. 그러나 .mp3 파일 등의 다른 모든 파일은 필터링 없이 마이그레이션됩니다. |
|
모든 사용자에 대해 내 비디오를 마이그레이션합니다. |
<?xml version="1.0" encoding="UTF-8"?>
<migration urlid="https://www.microsoft.com/migration/1.0/migxmlext/CustomFile">
<component type="Documents" context="User">
<displayName>My Video</displayName>
<role role="Data">
<detects>
<detect>
<condition>MigXmlHelper.DoesObjectExist("File","%CSIDL_MYVIDEO%")</condition>
</detect>
</detects>
<rules>
<include filter='MigXmlHelper.IgnoreIrrelevantLinks()'>
<objectSet>
<pattern type="File">%CSIDL_MYVIDEO%\* [*]</pattern>
</objectSet>
</include>
</rules>
</role>
</component>
</migration>
예 3: 파일 및 레지스트리 키 마이그레이션
이 표에서는 다음 예제 .xml 파일의 동작에 대해 설명합니다.
코드 | 동작 |
---|---|
|
%ProgramFiles%\USMTTestFolder 아래의 모든 하위 디렉터리에서 Usmttestfile.txt 파일을 모두 마이그레이션합니다. |
|
%ProgramFiles%\USMTDIRTestFolder 아래의 전체 디렉터리를 마이그레이션합니다. |
|
HKCU\Software\USMTTESTKEY 아래의 MyKey를 모두 마이그레이션합니다. |
|
HKLM\Software\USMTTESTKEY 아래의 전체 레지스트리 하이브를 마이그레이션합니다. |
<migration urlid="https://www.microsoft.com/migration/1.0/migxmlext/testfilemig">
<component type="Application" context="System">
<displayName>File Migration Test</displayName>
<role role="Data">
<rules context="System">
<include>
<objectSet>
<pattern type="File">%ProgramFiles%\USMTTestFolder\* [USMTTestFile.txt]</pattern><pattern type="File">%ProgramFiles%\USMTDIRTestFolder\* [*]</pattern>
</objectSet>
</include>
</rules>
</role>
</component>
<component type="System">
<displayName>Registry Migration Test</displayName>
<role role="Settings">
<rules context="UserAndSystem">
<include>
<objectSet>
<pattern type="Registry">HKCU\Software\USMTTESTKEY\* [MyKey]</pattern>
<pattern type="Registry">HKLM\Software\USMTTESTKEY\* [*]</pattern>
</objectSet>
</include>
</rules>
</role>
</component>
</migration>
예 4: 여러 위치에서 특정 폴더 마이그레이션
이 사용자 지정 .xml 파일의 동작은 코드의 <displayName
> 태그 안에 설명되어 있습니다.
<migration urlid="https://www.microsoft.com/migration/1.0/migxmlext/test">
<component type="Documents" context="System">
<displayName>Component to migrate all Engineering Drafts subfolders without documents in this folder </displayName>
<role role="Data">
<rules>
<include>
<objectSet>
<pattern type="File"> C:\EngineeringDrafts\* [*]</pattern>
</objectSet>
</include>
<exclude>
<objectSet>
<pattern type="File"> C:\EngineeringDrafts\ [*]</pattern>
</objectSet>
</exclude>
</rules>
</role>
</component>
<component type="Documents" context="System">
<displayName>Component to migrate all user documents except Sample.doc</displayName>
<role role="Data">
<rules>
<include>
<objectSet>
<pattern type="File"> C:\UserDocuments\* [*]</pattern>
</objectSet>
</include>
<exclude>
<objectSet>
<pattern type="File"> C:\UserDocuments\ [Sample.doc]</pattern>
</objectSet>
</exclude>
</rules>
</role>
</component>
<component type="Documents" context="System">
<displayName>Component to migrate all Requests folders on any drive on the computer </displayName>
<role role="Data">
<rules>
<include>
<objectSet>
<script>MigXmlHelper.GenerateDrivePatterns ("\Requests\* [*] ", "Fixed")</script>
<script>MigXmlHelper.GenerateDrivePatterns ("*\Requests\* [*] ", "Fixed")</script>
</objectSet>
</include>
</rules>
</role>
</component>
<component type="Documents" context="System">
<displayName>Component to migrate all Presentations folder from any location on the C: drive </displayName>
<role role="Data">
<rules>
<include>
<objectSet>
<pattern type="File"> C:\*\Presentations\* [*]</pattern>
<pattern type="File"> C:\Presentations\* [*]</pattern>
</objectSet>
</include>
</rules>
</role>
</component>
</migration>