Visual Studio Mac - Preview 9 (7.0 build 2943) Cannot create New Xamarin Forms Project

AdamVenturellaAdamVenturella USMember ✭✭
edited April 2017 in Visual Studio

It looks like it unfolds the template. Making no additional changes to the project after the template has generated I try to build the project and It cannot find the Namespace Xamarin

Error CS0246: The type or namespace name 'Xamarin' could not be found (are you missing a using directive or an assembly reference?) (CS0246) (MyProject)

Anything that uses Xamarin.Forms throws this error.

Looking at the references for the iOS project the following Forms related libs are present:

  • Xamarin.Forms.Core.dll
  • Xamarin.Forms.Platform.dll
  • Xamarin.Forms.Platform.iOS.dll
  • Xamarin.Forms.Xaml.dll

Additionally the other references are:

  • System
  • System.Xml
  • System.Core
  • Xamarin.iOS
  • MyProject

I want to again stress I have made 0 alterations, just asked it to make me a new forms project and attempted to build it after the packages finished downloading.

Looking at the contents of the .csproj the following references are indeed there:

<ItemGroup>
    <Reference Include="Xamarin.Forms.Core">
      <HintPath>packages\Xamarin.Forms.2.3.4.231\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Core.dll</HintPath>
    </Reference>
    <Reference Include="Xamarin.Forms.Platform">
      <HintPath>packages\Xamarin.Forms.2.3.4.231\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Platform.dll</HintPath>
    </Reference>
    <Reference Include="Xamarin.Forms.Xaml">
      <HintPath>packages\Xamarin.Forms.2.3.4.231\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Xaml.dll</HintPath>
    </Reference>
  </ItemGroup>
<Import Project="packages\Xamarin.Forms.2.3.4.231\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets" Condition="Exists('packages\Xamarin.Forms.2.3.4.231\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets')" />

If I manually set it up:

  • Create a multiplatform App
  • Create a Forms Class Library
  • Alter the App Delegate accordingly for init
  • Add Xamarin.Forms packages to the targets

Everything builds and runs fine. So it's just the project template it would seem.

Tagged:

Answers

  • JGoldbergerJGoldberger USMember, Forum Administrator, Xamarin Team, University Xamurai

    @AdamVenturella

    I can't reproduce this issue. Using the same version of Visual Studio for Mac as noted in the title I was able to create, build, and deploy a new from template Xamarin Forms app without issue.

    What exact template are you using? Can you provide exact steps to reproduce the issue? Thanks in advance!

  • AdamVenturellaAdamVenturella USMember ✭✭

    Here's what I am doing.

    • Start Visual Studio Mac

    • Select New Project

    • Choose Multiplatform -> App -> Blank Forms App

    • Proceed with default settings

    • Allow packages to install

    • Attempt to build project for iOS without changing any code.

    The packages are there:

    And the references are there:

    iOS


    Forms


    If I remove Xamarin.Forms package from the Forms App and re-add it, it will build. Just not out of the box.

  • JGoldbergerJGoldberger USMember, Forum Administrator, Xamarin Team, University Xamurai

    Odd, I still can not reproduce. It works out of the box on my end and that was exactly what I tried yesterday too. I have seen similar issues in the past where just closing and reopening the solution forces the references to resolve correctly.

Sign In or Register to comment.