KatsuYuzuのブログ

.NET の開発をメインとした日記です。

TFS(Team Foundation Service)では日本語のコードをビルドできない

先日、AccentColorCameraを高速化と写真の向き補正いれて更新申請しました!
それで、ソースコードをTFSで管理していて、先日の方法でゲートチェックインも組んでいるのですが……

事件が起きまして。
f:id:KatsuYuzu:20130307231030p:plain
ビルドがこけた!
f:id:KatsuYuzu:20130307225025p:plain
チェックインがはじかれた!(ちょっとワクワクした!)

エラー 25、警告 0
$/Accent Color Camera/Sources/Accent Color Camera-Release/AccentColorCamera.sln - 25 エラー、0 警告、 ログ ファイルの表示
Views\MainPage.xaml.cs (35): Unexpected character ''
Views\MainPage.xaml.cs (111): A namespace cannot directly contain members such as fields or methods
Views\MainPage.xaml.cs (109): Expected class, delegate, enum, interface, or struct
Views\MainPage.xaml.cs (92): Expected class, delegate, enum, interface, or struct
Views\MainPage.xaml.cs (73): Expected class, delegate, enum, interface, or struct
Views\MainPage.xaml.cs (68): A namespace cannot directly contain members such as fields or methods
Views\MainPage.xaml.cs (64): Unexpected character '‚'
Views\MainPage.xaml.cs (64): Unexpected character '¹'
(中略)
Views\MainPage.xaml.cs (35): Unexpected character '•'
Views\MainPage.xaml.cs (64): Unexpected character '‚'
Views\MainPage.xaml.cs (115): Type or namespace definition, or end-of-file expected

Exception Message: MSBuild error 1 has ended this build. You can find more specific information about the cause of this error in above messages. (type BuildProcessTerminateException)
Exception Stack Trace: at System.Activities.Statements.Throw.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

なんのこっちゃい。
なんとなくソースコード読めてないんだなーくらいにしかわからなかったのですが、すぐにピンときて、タイトルの通りであっさり解決。原因は日本語のコード。

MessageBox.Show(AccentColorCamera.Resources.StringResource.プライマリーカメラがサポートされていません);

多言語対応した時にリソース名を日本語にしてたせいでした。さすがにロジック内に日本語コードは登場しませんよ*1!も、もちろんビルドも手元では通るんですよ!……リソースが英語だと何のメッセージかわからなくなったりして(笑)
皆さんも気を付けてください。

追記 2013/03/08

せっかくなのでVisual StudioのFeedbackに投稿してみました。
Allow 2 byte char on the TFS(Team Foundation Service) Build Service – Customer Feedback for Microsoft

*1:そういや単体テストコードのメソッド名は日本語にしてるなー。直観的で。参考にしたサイトがそうだったから疑わずに納得してた。