Fresh Xamarin Multiplatform Library 构建失败(从 Visual Studio 为 Mac 创建)

Fresh Xamarin Multiplatform Library fails to build (created from Visual Studio for Mac)

我使用 Visual Studio 为 Mac.

创建了一个 Xamarin 多平台库

然后我只是构建了 MyProject.NuGet 项目,没有任何更改,它失败了。

查看错误时,它显示,

Cannot create a package that has no dependencies nor content.

还有这些警告,

warning : The referenced project 'MyProject.Android' does not exist.
warning : The referenced project 'MyProject.iOS' does not exist.

但是 MyProject.AndroidMyProject.iOS 存在于解决方案中并且它们在MyProject.NuGet 项目也是如此。

  • .NuGet项目中,打开References,然后删除iOSAndroid 项目引用。

  • 保存解决方案。

  • 重新添加iOSAndroid项目作为项目引用.NuGet 项目。

  • 立即尝试构建 .NuGet 项目!

注意: 确保 .NuGet.csproj 文件中的更改已更新

项目参考应该从

<ProjectReference Include="MyProject.iOS">
  ...
</ProjectReference>
<ProjectReference Include="MyProject.Android">
  ...
</ProjectReference>

<ProjectReference Include="..\MyProject.iOS\MyProject.iOS.csproj">
  ...
</ProjectReference>
<ProjectReference Include="..\MyProject.Android\MyProject.Android.csproj">
  ...
</ProjectReference>

MyProject.NuGet.csproj 文件中