かずきのBlog@hatena

すきな言語は C# + XAML の組み合わせ。Azure Functions も好き。最近は Go 言語勉強中。日本マイクロソフトで働いていますが、ここに書いていることは個人的なメモなので会社の公式見解ではありません。

UWPでリリースビルドをすると英語環境以外で落ちる問題への対処方法

英語環境以外で、PCLで英語しかリソースの用意されていないライブラリを参照して使うとリソースを使ってるところで例外が出てアプリが落ちてしまう問題があります。まぁ修正はしようとしてるんでしょうけど、

因みにビルド時にこんな警告がいっぱい出ると、例外で落ちる可能性があるということになります。

1>MakePRI : warning 0xdef00522: Resources found for language(s) 'en,en-us' but no resources found for default language(s): 'ja'. Change the default language or qualify resources with the default language. http://go.microsoft.com/fwlink/?LinkId=231899
1>MakePRI : warning 0xdef01051: No default or neutral resource given for 'Prism.Properties.Resources/DelegateCommandDelegatesCannotBeNull'. The application may throw an exception for certain user configurations when retrieving the resources.
1>MakePRI : warning 0xdef01051: No default or neutral resource given for 'Prism.Properties.Resources/CannotRegisterCompositeCommandInItself'. The application may throw an exception for certain user configurations when retrieving the resources.
1>MakePRI : warning 0xdef01051: No default or neutral resource given for 'Prism.Properties.Resources/CannotRegisterSameCommandTwice'. The application may throw an exception for certain user configurations when retrieving the resources.
1>MakePRI : warning 0xdef01051: No default or neutral resource given for 'Prism.Properties.Resources/InvalidPropertyNameException'. The application may throw an exception for certain user configurations when retrieving the resources.
1>MakePRI : warning 0xdef01051: No default or neutral resource given for 'Prism.Properties.Resources/PropertySupport_ExpressionNotProperty_Exception'. The application may throw an exception for certain user configurations when retrieving the resources.
1>MakePRI : warning 0xdef01051: No default or neutral resource given for 'Prism.Properties.Resources/PropertySupport_StaticExpression_Exception'. The application may throw an exception for certain user configurations when retrieving the resources.
1>MakePRI : warning 0xdef01051: No default or neutral resource given for 'Prism.Properties.Resources/InvalidDelegateRerefenceTypeException'. The application may throw an exception for certain user configurations when retrieving the resources.
1>MakePRI : warning 0xdef01051: No default or neutral resource given for 'Prism.Properties.Resources/PropertySupport_NotMemberAccessExpression_Exception'. The application may throw an exception for certain user configurations when retrieving the resources.
1>MakePRI : warning 0xdef01051: No default or neutral resource given for 'Prism.Properties.Resources/DelegateCommandInvalidGenericPayloadType'. The application may throw an exception for certain user configurations when retrieving the resources.

この問題の回避方法が書かれたBlogを見つけました。

metronuggets.com

このBlogによると

  • プロジェクトのアンロード
  • アンロードしたプロジェクトの右クリックメニューから編集
  • 最初のPropretyGroupに以下の1行を追加
<SkipIntermediatePriGenerationForResourceFiles>false</SkipIntermediatePriGenerationForResourceFiles>
  • プロジェクトの再読み込み

でリリースビルドしても大丈夫になるみたいです。早くこのバグなおらないかなぁ。