使用Xamarin Forms在Visual Studio中创建Hello World失败

时间:2016-04-01 03:01:44

标签: c# xamarin visual-studio-2015

我正在引用此解决方案/问题The type or namespace name 'Xamarin' missing in xamarin studio

然而,仍然无法从新的通用应用程序项目向导构建应用程序。

Severity    Code    Description Project File    Line    Suppression State
Error   CS0117  'Resource.Attribute' does not contain a definition for 'actionBarSize'  
Project.Droid   C:\dev\Project.Droid\Resources\Resource.Designer.cs 29  Active

来自新到Xamarin人群的任何想法?

1 个答案:

答案 0 :(得分:4)

好的,这就是答案!我有一个本地复制品,似乎.csproj中缺少一些参考文献:

请确保将以下内容添加到您的.csproj作为参考:

<Reference Include="Xamarin.Android.Support.Design, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
  <HintPath>..\..\packages\Xamarin.Android.Support.Design.23.0.1.3\lib\MonoAndroid403\Xamarin.Android.Support.Design.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Xamarin.Android.Support.v4, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
  <HintPath>..\..\packages\Xamarin.Android.Support.v4.23.0.1.3\lib\MonoAndroid403\Xamarin.Android.Support.v4.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Xamarin.Android.Support.v7.AppCompat, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
  <HintPath>..\..\packages\Xamarin.Android.Support.v7.AppCompat.23.0.1.3\lib\MonoAndroid403\Xamarin.Android.Support.v7.AppCompat.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Xamarin.Android.Support.v7.CardView, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
  <HintPath>..\..\packages\Xamarin.Android.Support.v7.CardView.23.0.1.3\lib\MonoAndroid403\Xamarin.Android.Support.v7.CardView.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Xamarin.Android.Support.v7.MediaRouter, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
  <HintPath>..\..\packages\Xamarin.Android.Support.v7.MediaRouter.23.0.1.3\lib\MonoAndroid403\Xamarin.Android.Support.v7.MediaRouter.dll</HintPath>
  <Private>True</Private>
</Reference>

然后,您可以从项目中删除Resource.designer.cs文件,重建项目,然后将Resource.designer.cs文件重新添加到项目中。它应生成以下Attribute项:https://gist.github.com/JonDouglas/7adf61469ce21663d7f536a4aa27c7df