[Windows]+[R]を押下する。
PowerShellを通常モードで起動する。
応答ファイルを準備する
C#コンパイラの応答ファイル(Response File)を準備する。
応答ファイル
GoogleDataAPI.rspを以下の通り作成する。
PS C:\Users\user01\Downloads> $REDIST="$Env:Programfiles\Google\Google Data API SDK\Redist"
PS C:\Users\user01\Downloads> $(echo "/lib:`"$REDIST`""; dir $REDIST\*.dll -exclude 'zlib.*' | foreach {"/r:$($_.Name)"}) > GoogleDataAPI.rsp
PS C:\Users\user01\Downloads>
内容を確認する。
PS C:\Users\user01\Downloads> cat .\GoogleDataAPI.rsp
/lib:"C:\Program Files\Google\Google Data API SDK\Redist"
/r:Google.GData.AccessControl.DLL
/r:Google.GData.Analytics.dll
/r:Google.GData.Apps.dll
/r:Google.GData.Blogger.dll
/r:Google.GData.Calendar.dll
/r:Google.GData.Client.dll
/r:Google.GData.Contacts.dll
/r:Google.GData.ContentForShopping.dll
/r:Google.GData.Documents.dll
/r:Google.GData.Extensions.dll
/r:Google.GData.Photos.dll
/r:Google.GData.Spreadsheets.dll
/r:Google.GData.WebmasterTools.dll
/r:Google.GData.YouTube.dll
/r:Newtonsoft.Json.dll
PS C:\Users\user01\Downloads>
Aliasの設定
C#コンパイラ
csc.exeは、インストールされている.Net Frameworkのバージョン毎に存在していて、PATHが通っていない。毎回フルパスで指定するのは煩雑なので、エイリアスを設定する。以下の通り作業する。ここでは、.Net Framework v3.5の
csc.exeを使う。
PS C:\Users\user01\Downloads> Set-Alias csc $Env:windir\Microsoft.NET\Framework\v3.5\csc.exe
PS C:\Users\user01\Downloads>
以下の通り確認する。
PS C:\Users\user01\Downloads> csc
Microsoft (R) Visual C# 2008 Compiler version 3.5.30729.5420
for Microsoft (R) .NET Framework version 3.5
Copyright (C) Microsoft Corporation. All rights reserved.
fatal error CS2008: 入力が指定されていません。
PS C:\Users\user01\Downloads>
コンパイル
『
その1・サンプルコードのダウンロード』でダウンロードした
migrationsample.csをコンパイルする。コンパイルする際、前に作成した応答ファイル
GoogleDataAPI.rspを指定する。
PS C:\Users\user01\Downloads> csc '@GoogleDataAPI.rsp' migrationsample.cs
Microsoft (R) Visual C# 2008 Compiler version 3.5.30729.5420
for Microsoft (R) .NET Framework version 3.5
Copyright (C) Microsoft Corporation. All rights reserved.
warning CS1685: 定義済みの型 'System.Runtime.CompilerServices.ExtensionAttribute' は、グローバル
エイリアスの複数のアセンブリ内で定義されています。'c:\Program Files\Reference
Assemblies\Microsoft\Framework\v3.5\System.Core.dll' からの定義を使用してください。
PS C:\Users\user01\Downloads>
警告が表示されるが、コンパイルは正常に終了していて、
migrationsample.exeが作成されている。
PS C:\Users\user01\Downloads> dir
ディレクトリ: C:\Users\user01\Downloads
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 2012/10/17 23:09 2433 Add-AssemblyToGlobalAssemblyCache.ps1
-a--- 2012/10/17 23:18 1046 GoogleDataAPI.rsp
-a--- 2012/10/17 22:38 29167616 Google_Data_API_Setup_2.1.0.0.msi
-a--- 2012/10/17 22:29 8008 migrationsample.cs
-a--- 2012/10/17 23:33 9728 migrationsample.exe
PS C:\Users\user01\Downloads>
引数を与えずに実行すると、使い方が表示される。
PS C:\Users\user01\Downloads> .\migrationsample.exe
Usage:
migration_sample [destination_email]
domain:
The hosted domain (e.g. example.com) in which the migration will occur.
login_user:
The username of the administrator or user migrating mail.
login_password:
The password of the administrator or user migrating mail.
destination_user:
The username to which emails should be migrated. End users can only transfer mail to their own mailboxes. If unspecified, will default to login_email.
PS C:\Users\user01\Downloads>
『その0・概要』
『その1・サンプルコードのダウンロード』
『その2・Google Data API Installer MSIのダウンロード』
『その3・Global Assembly Cache Toolのダウンロードと改造』
『その4・Google Data API Installer MSIのインストール』
『その5・PowerShell実行ポリシの変更』
『その6・Google Data APIアセンブリのGACへのインストール』
『その7・サンプルコードのコンパイル』