加载失败UWP.csproj:错误:对象引用未设置为对象的实例

时间:2017-10-11 18:56:33

标签: xamarin uwp

在Visual Studio 2017 15.4之后,我的Xamarin.UWP突然无法加载。

我确实更新了我的Xamarin PCL和其他人。但UWP项目将不再加载。我无法达到目标?

我在VS IDE输出中得到了这个;

UWP.csproj : error : Object reference not set to an instance of an object.

我将如何解决这个问题?

2 个答案:

答案 0 :(得分:1)

我遇到了同样的问题,结果发现错误是由于没有UWP项目的所有资产造成的,因此我确保项目已将所有资产添加到UWP.csproj fil和assets文件夹中。

所以我的ItemGroup看起来像这样

<ItemGroup>
    <Content Include="Properties\Default.rd.xml" />
    <Content Include="Assets\LockScreenLogo.scale-100.png" />
    <Content Include="Assets\LockScreenLogo.scale-125.png" />
    <Content Include="Assets\LockScreenLogo.scale-150.png" />
    <Content Include="Assets\LockScreenLogo.scale-200.png" />
    <Content Include="Assets\LockScreenLogo.scale-400.png" />
    <Content Include="Assets\SplashScreen.scale-100.png" />
    <Content Include="Assets\SplashScreen.scale-125.png" />
    <Content Include="Assets\SplashScreen.scale-150.png" />
    <Content Include="Assets\SplashScreen.scale-200.png" />
    <Content Include="Assets\SplashScreen.scale-400.png" />
    <Content Include="Assets\Square150x150Logo.scale-100.png" />
    <Content Include="Assets\Square150x150Logo.scale-125.png" />
    <Content Include="Assets\Square150x150Logo.scale-150.png" />
    <Content Include="Assets\Square150x150Logo.scale-200.png" />
    <Content Include="Assets\Square150x150Logo.scale-400.png" />
    <Content Include="Assets\Square44x44Logo.scale-100.png" />
    <Content Include="Assets\Square44x44Logo.scale-125.png" />
    <Content Include="Assets\Square44x44Logo.scale-150.png" />
    <Content Include="Assets\Square44x44Logo.scale-200.png" />
    <Content Include="Assets\Square44x44Logo.scale-400.png" />
    <Content Include="Assets\Square44x44Logo.targetsize-16_altform-unplated.png" />
    <Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
    <Content Include="Assets\Square44x44Logo.targetsize-32_altform-unplated.png" />
    <Content Include="Assets\Square44x44Logo.targetsize-48_altform-unplated.png" />
    <Content Include="Assets\Square44x44Logo.targetsize-256_altform-unplated.png" />
    <Content Include="Assets\StoreLogo.png" />
    <Content Include="Assets\Wide310x150Logo.scale-100.png" />
    <Content Include="Assets\Wide310x150Logo.scale-125.png" />
    <Content Include="Assets\Wide310x150Logo.scale-150.png" />
    <Content Include="Assets\Wide310x150Logo.scale-200.png" />
    <Content Include="Assets\Wide310x150Logo.scale-400.png" />
  </ItemGroup>

答案 1 :(得分:1)

从vs2015升级到vs2017之后我遇到了这个问题。

在此之后 link 并且替换平台目标,它再次加载。

(是的,我知道,它似乎没有任何意义)

  • 右键单击目标UWP项目,然后选择“编辑”
  • 更改查找和更改这些值的键:

替换:

<TargetPlatformVersion>10.0.16299.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.10586.0</TargetPlatformMinVersion>

注意:项目的平台目标可能会中断。