所以今天我错误地将我的 IDE 更新到 2017.3。

然后我收到了不兼容的通知,例如

“NU1202:Xamarin.Forms 2.3.4.247 包与 netstandard1.5 不兼容。包支持:目标列表,如 monoandroid10、xamarinios10 等”

在谷歌上调查此事后,我找到了一些信息来尝试修复该项目。

https://github.com/NancyFx/Nancy/issues/2647#issuecomment-265927440 建议添加一个框架名称来构建它(在修复尝试的某个时候,我也收到了平台警告)

我为解决该问题所做的另一个尝试是将项目重新创建为使用 netstandard 项目的新模板版本(我为 repro 提供的项目是在 project.json 仍然存在的时候创建的)

您可能会问为什么:在查找问题时,我读到一些是误报错误消息,可以像这样 Package Reference Warning Ignore 禁用它们 - 但是在这个完全基于 .csproj 的项目类型中,我无法添加 Xamarin.Forms 2.3 .4.247。

所以我的问题是:

有没有人能够在 vs2017.3 上运行类似的项目?

REPRO 项目:

GitHub

最佳答案

改变我的项目类似于这样的结果后:

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <TargetFramework>netstandard1.5</TargetFramework>
        <PackageTargetFallback>portable-net45+win8+wpa81+wp8</PackageTargetFallback>
    </PropertyGroup>

    <ItemGroup>
      <EmbeddedResource Include="App.xaml">
        <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
      </EmbeddedResource>
      <EmbeddedResource Include="MainPage.xaml">
        <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
      </EmbeddedResource>
    </ItemGroup>

    <ItemGroup>
        <PackageReference Include="Microsoft.NETCore.Portable.Compatibility" Version="1.0.1" />
        <PackageReference Include="Xamarin.Forms" Version="2.3.4.247" />
    </ItemGroup>

    <ItemGroup>
      <Compile Update="App.xaml.cs">
        <DependentUpon>App.xaml</DependentUpon>
      </Compile>
      <Compile Update="MainPage.xaml.cs">
        <DependentUpon>MainPage.xaml</DependentUpon>
      </Compile>
    </ItemGroup>
</Project>

项目再次编译。
<PackageTargetFallback>portable-net45+win8+wpa81+wp8</PackageTargetFallback>

解决了这个问题。

关于Xamarin.Forms netstandard 项目因 VS 2017.3 更新而中断,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/45696164/

10-12 14:54
查看更多