古事連記帖

趣味のこと、技術的なこと、適当につらつら書きます。

Microsoft.NETCore.UniversalWindowsPlatform をアップデートすると、VSTS でビルドが通らなくなる問題の対策

UWP でアプリを書いているとき、ふと NuGet で Microsoft.NETCore.UniversalWindowsPlatform に更新が来ていたりします。
アップデートする分には問題ないですが、アップデートした状態で Visual Studio Team Services でビルド掛けるとなぜかビルドに失敗します。

2016-08-24T15:52:49.2593806Z System.Net.WebHeaderCollection 4.0.1 is not compatible with UAP,Version=v10.0.
2016-08-24T15:52:49.2593806Z Microsoft.NETCore.Targets 1.0.2 is not compatible with UAP,Version=v10.0.
2016-08-24T15:52:49.2593806Z System.Net.WebSockets 4.0.0 is not compatible with UAP,Version=v10.0.
2016-08-24T15:52:49.2593806Z Microsoft.Win32.Primitives 4.0.1 is not compatible with UAP,Version=v10.0.
2016-08-24T15:52:49.2593806Z System.Net.Sockets 4.1.0 is not compatible with UAP,Version=v10.0.
2016-08-24T15:52:49.2593806Z System.Text.Encoding.CodePages 4.0.1 is not compatible with UAP,Version=v10.0.
2016-08-24T15:52:49.2593806Z System.Diagnostics.StackTrace 4.0.2 is not compatible with UAP,Version=v10.0.
2016-08-24T15:52:49.2593806Z System.Net.WebSockets.Client 4.0.0 is not compatible with UAP,Version=v10.0.
2016-08-24T15:52:49.2593806Z System.Net.NameResolution 4.0.0 is not compatible with UAP,Version=v10.0.
2016-08-24T15:52:49.2593806Z System.Reactive.Interfaces 3.0.0 is not compatible with UAP,Version=v10.0.
2016-08-24T15:52:49.2593806Z System.Reactive.Linq 3.0.0 is not compatible with UAP,Version=v10.0.
2016-08-24T15:52:49.2593806Z Microsoft.NETCore.Platforms 1.0.1 is not compatible with UAP,Version=v10.0.
2016-08-24T15:52:49.2593806Z System.Security.Cryptography.X509Certificates 4.1.0 is not compatible with UAP,Version=v10.0.
2016-08-24T15:52:49.2750080Z System.IO.FileSystem.Primitives 4.0.1 is not compatible with UAP,Version=v10.0.
2016-08-24T15:52:49.2750080Z System.IO.FileSystem 4.0.1 is not compatible with UAP,Version=v10.0.
2016-08-24T15:52:49.2750080Z System.Private.DataContractSerialization 4.1.1 is not compatible with UAP,Version=v10.0.
2016-08-24T15:52:49.2750080Z System.Runtime.Handles 4.0.1 is not compatible with UAP,Version=v10.0.
2016-08-24T15:52:49.2750080Z System.Xml.XmlDocument 4.0.1 is not compatible with UAP,Version=v10.0.
2016-08-24T15:52:49.2750080Z System.Reflection.DispatchProxy 4.0.1 is not compatible with UAP,Version=v10.0.

... (中略) ...

2016-08-24T15:52:49.8843904Z ##[debug]rc:1
2016-08-24T15:52:49.8843904Z ##[debug]success:false
2016-08-24T15:52:49.8843904Z ##[debug]Processing: ##vso[task.issue type=error;]Error: C:\agent\externals\nuget\nuget.exe failed with return code: 1
2016-08-24T15:52:49.9000123Z ##[error]Error: C:\agent\externals\nuget\nuget.exe failed with return code: 1
2016-08-24T15:52:49.9000123Z ##[debug]Processing: ##vso[task.issue type=error;]Packages failed to install
2016-08-24T15:52:49.9000123Z ##[error]Packages failed to install
2016-08-24T15:52:49.9000123Z ##[debug]task result: Failed
2016-08-24T15:52:49.9000123Z ##[debug]Processing: ##vso[task.issue type=error;]Return code: 1
2016-08-24T15:52:49.9000123Z ##[error]Return code: 1
2016-08-24T15:52:49.9000123Z ##[debug]Processing: ##vso[task.complete result=Failed;]Return code: 1

みたいな感じでずらずらーっと怒られます。
仕方ないので元のバージョンに戻すのがいいんですが、他の NuGet パッケージによっては依存関係にある場合もあるのでなかなか悩ましい。

もし、ビルドサーバーを自前で立てていて、Agent として登録しているのであれば解決することが出来ます。


この issue が役に立ちました。
github.com

要するに、Agent のパッケージに含まれる NuGet をアップデートして 3.4.4-rtm-final にしてやればいいのです。

C:\agent\externals\nuget> ./nuget update -self

コマンドはこんな感じ。これでアップデートできますので、終わったらビルドしてみましょう。あと、少し前に配布されていた agent のパッケージを使っている場合、いつの間にか Legacy になってるので、これを期に新しいやつ (ちょっと前まで preview だとか beta になってたやつ) に差し替えておくといいと思います。



ちなみに VSTS が用意する Hosted を使っている場合は現時点ではやり方はわかりませんでした。なのでアップデートを待つしかありません。
もしやり方があるのようでしたらご教示いただけると助かります。