本文章记录以前遇到的一个和Microsoft.Services.Store.Engagement有关的问题。当时解决后没想到最近有小伙伴又遇到了,所以在此做个记录。

错误

Method ‘StoreServicesEngagementManager.GetDefault()’ from assembly ‘Microsoft.Services.Store.Engagement’ was not included in compilation, but was referenced in xxxxxxx.

描述:只要使用**Windows Template Studio 3.3** 以前的版本生成了使用Microsoft.Services.Store.Engagement的代码,上传商店后就会出现这个问题。本地测试正常。

解决方法

来自这个issue

This is not an issue with using AppCenter. It can affect any app submitted to the store.

How to fix this in the code in your existing apps

Manually open the csproj file.

change the following lines from

<SDKReference Include="Microsoft.Services.Store.Engagement, version=10.0">
  <Name>Microsoft Engagement Framework</Name>
</SDKReference>
<SDKReference Include="Microsoft.VCLibs, version=14.0">
  <Name>Visual C++ 2015 Runtime for Universal Windows Platform Apps</Name>
</SDKReference>

to

<SDKReference Include="Microsoft.Services.Store.Engagement, Version=10.0">
  <Name>Microsoft Engagement Framework</Name>
</SDKReference>
<SDKReference Include="Microsoft.VCLibs, Version=14.0">
  <Name>Visual C++ 2015 Runtime for Universal Windows Platform Apps</Name>
</SDKReference>

In both cases, it must be Version (with a capital ‘V’) rather than version.

其实就是把两个SDK的version改成首字母大写的Version