1
votes

I have a Xamarin.Forms project in Visual Studio for Mac. Currently, I am able to build the iOS project, but I am not given the option to run it:

top bar with build icon the run tab

Additionally, I have many build types available. None of them allow me to run. Types of build avaliable

Most of the progress I've made has been in the iOS csproj file, so here it is.

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="..\..\packages\Xamarin.Forms.3.4.0.1008975\build\Xamarin.Forms.props" Condition="Exists('..\..\packages\Xamarin.Forms.3.4.0.1008975\build\Xamarin.Forms.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">iPhone</Platform>
    <ProductVersion>8.0.30703</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{A49C2037-7B2A-43EB-BCDB-62E1BEEB4EE7}</ProjectGuid>
    <ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <OutputType>Exe</OutputType>
    <RootNamespace>APPNAME.iOS</RootNamespace>
    <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
    <AssemblyName>APPNAME.iOS</AssemblyName>
    <NuGetPackageImportStamp>
    </NuGetPackageImportStamp>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\iPhone\Debug</OutputPath>
    <DefineConstants>DEBUG</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <ConsolePause>false</ConsolePause>
    <MtouchArch>ARM64</MtouchArch>
    <CodesignKey>iPhone Developer</CodesignKey>
    <MtouchDebug>true</MtouchDebug>
    <!--<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>-->
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
    <DefineConstants>DEBUG</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <ConsolePause>false</ConsolePause>
    <MtouchArch>x86_64</MtouchArch>
    <MtouchLink>None</MtouchLink>
    <MtouchDebug>true</MtouchDebug>
    <CodesignEntitlements></CodesignEntitlements>
    <CodesignKey>iPhone Developer</CodesignKey>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
    <DebugType>none</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\iPhone\Release</OutputPath>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <MtouchArch>ARMv7, ARM64</MtouchArch>
    <ConsolePause>false</ConsolePause>
    <CodesignKey>iPhone Developer</CodesignKey>
    <!--<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>-->
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
    <DebugType>none</DebugType>
    <Optimize>True</Optimize>
    <OutputPath>bin\iPhone\Ad-Hoc</OutputPath>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <ConsolePause>False</ConsolePause>
    <MtouchArch>ARMv7, ARM64</MtouchArch>
    <BuildIpa>True</BuildIpa>
    <CodesignProvision>Automatic:AdHoc</CodesignProvision>
    <CodesignKey>iPhone Distribution</CodesignKey>
    <!--<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>-->
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
    <DebugType>none</DebugType>
    <Optimize>True</Optimize>
    <OutputPath>bin\iPhone\AppStore</OutputPath>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <ConsolePause>False</ConsolePause>
    <MtouchArch>ARMv7, ARM64</MtouchArch>
    <CodesignProvision>Automatic:AppStore</CodesignProvision>
    <CodesignKey>iPhone Distribution</CodesignKey>
    <!--<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>-->
  </PropertyGroup>
  <PropertyGroup Condition=" '$(RunConfiguration)' == 'Default' ">
    <AppExtensionDebugBundleId />
  </PropertyGroup>
  <ItemGroup>
    <Compile Include="Data\NetworkConnection.cs" />
    <Compile Include="Data\SQL_IOS.cs" />
    <Compile Include="Helpers\Settings.cs" />
    <Compile Include="Main.cs" />
    <Compile Include="AppDelegate.cs" />
    <None Include="app.config" />
    <None Include="Entitlements.plist" />
    <None Include="Info.plist" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <ITunesArtwork Include="iTunesArtwork" />
    <ITunesArtwork Include="iTunesArtwork@2x" />
    <None Include="packages.config" />
    <Compile Include="PicturePickerImplementation.cs" />
  </ItemGroup>
  <ItemGroup>
    <BundleResource Include="Resources\Default-568h%402x.png" />
    <BundleResource Include="Resources\Default-Portrait.png" />
    <BundleResource Include="Resources\Default-Portrait%402x.png" />
    <BundleResource Include="Resources\Default.png" />
    <BundleResource Include="Resources\Default%402x.png" />
    <BundleResource Include="Resources\Icon-60%402x.png" />
    <BundleResource Include="Resources\Icon-60%403x.png" />
    <BundleResource Include="Resources\Icon-76.png" />
    <BundleResource Include="Resources\Icon-76%402x.png" />
    <BundleResource Include="Resources\Icon-Small-40.png" />
    <BundleResource Include="Resources\Icon-Small-40%402x.png" />
    <BundleResource Include="Resources\Icon-Small-40%403x.png" />
    <BundleResource Include="Resources\Icon-Small.png" />
    <BundleResource Include="Resources\Icon-Small%402x.png" />
    <BundleResource Include="Resources\Icon-Small%403x.png" />
    <InterfaceDefinition Include="Resources\LaunchScreen.storyboard" />
    <BundleResource Include="Resources\passwordicon.png" />
    <BundleResource Include="Resources\usernameicon.png" />
    <BundleResource Include="Resources\checkmark.png" />
    <BundleResource Include="Resources\loading.jpg" />
    <BundleResource Include="Resources\noimage.jpeg" />
  </ItemGroup>
  <ItemGroup>
    <Reference Include="Plugin.Settings, Version=3.1.1.0, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\..\packages\Xam.Plugins.Settings.3.1.1\lib\Xamarin.iOS10\Plugin.Settings.dll</HintPath>
    </Reference>
    <Reference Include="Plugin.Settings.Abstractions, Version=3.1.1.0, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\..\packages\Xam.Plugins.Settings.3.1.1\lib\Xamarin.iOS10\Plugin.Settings.Abstractions.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Xml" />
    <Reference Include="System.Core" />
    <Reference Include="Xamarin.iOS" />
    <Reference Include="SQLitePCLRaw.core">
      <HintPath>..\..\packages\SQLitePCLRaw.core.1.1.11\lib\Xamarin.iOS10\SQLitePCLRaw.core.dll</HintPath>
    </Reference>
    <Reference Include="SQLitePCLRaw.provider.sqlite3">
      <HintPath>..\..\packages\SQLitePCLRaw.provider.sqlite3.ios_unified.1.1.11\lib\Xamarin.iOS10\SQLitePCLRaw.provider.sqlite3.dll</HintPath>
    </Reference>
    <Reference Include="SQLitePCLRaw.batteries_green">
      <HintPath>..\..\packages\SQLitePCLRaw.bundle_green.1.1.11\lib\Xamarin.iOS10\SQLitePCLRaw.batteries_green.dll</HintPath>
    </Reference>
    <Reference Include="SQLitePCLRaw.batteries_v2">
      <HintPath>..\..\packages\SQLitePCLRaw.bundle_green.1.1.11\lib\Xamarin.iOS10\SQLitePCLRaw.batteries_v2.dll</HintPath>
    </Reference>
    <Reference Include="SQLite-net">
      <HintPath>..\..\packages\sqlite-net-pcl.1.5.231\lib\netstandard1.1\SQLite-net.dll</HintPath>
    </Reference>
    <Reference Include="Plugin.Connectivity.Abstractions">
      <HintPath>..\..\packages\Xam.Plugin.Connectivity.3.2.0\lib\Xamarin.iOS10\Plugin.Connectivity.Abstractions.dll</HintPath>
    </Reference>
    <Reference Include="Plugin.Connectivity">
      <HintPath>..\..\packages\Xam.Plugin.Connectivity.3.2.0\lib\Xamarin.iOS10\Plugin.Connectivity.dll</HintPath>
    </Reference>
    <Reference Include="Xamarin.Forms.Core">
      <HintPath>..\..\packages\Xamarin.Forms.3.4.0.1008975\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll</HintPath>
    </Reference>
    <Reference Include="Xamarin.Forms.Platform">
      <HintPath>..\..\packages\Xamarin.Forms.3.4.0.1008975\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll</HintPath>
    </Reference>
    <Reference Include="Xamarin.Forms.Platform.iOS">
      <HintPath>..\..\packages\Xamarin.Forms.3.4.0.1008975\lib\Xamarin.iOS10\Xamarin.Forms.Platform.iOS.dll</HintPath>
    </Reference>
    <Reference Include="Xamarin.Forms.Xaml">
      <HintPath>..\..\packages\Xamarin.Forms.3.4.0.1008975\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll</HintPath>
    </Reference>
    <Reference Include="WebP.Touch">
      <HintPath>..\..\packages\WebP.Touch.1.0.8\lib\Xamarin.iOS10\WebP.Touch.dll</HintPath>
    </Reference>
    <Reference Include="FFImageLoading">
      <HintPath>..\..\packages\Xamarin.FFImageLoading.2.4.4.859\lib\Xamarin.iOS10\FFImageLoading.dll</HintPath>
    </Reference>
    <Reference Include="FFImageLoading.Platform">
      <HintPath>..\..\packages\Xamarin.FFImageLoading.2.4.4.859\lib\Xamarin.iOS10\FFImageLoading.Platform.dll</HintPath>
    </Reference>
    <Reference Include="FFImageLoading.Forms">
      <HintPath>..\..\packages\Xamarin.FFImageLoading.Forms.2.4.4.859\lib\Xamarin.iOS10\FFImageLoading.Forms.dll</HintPath>
    </Reference>
    <Reference Include="FFImageLoading.Forms.Platform">
      <HintPath>..\..\packages\Xamarin.FFImageLoading.Forms.2.4.4.859\lib\Xamarin.iOS10\FFImageLoading.Forms.Platform.dll</HintPath>
    </Reference>
    <Reference Include="FFImageLoading.Transformations">
      <HintPath>..\..\packages\Xamarin.FFImageLoading.Transformations.2.4.4.859\lib\Xamarin.iOS10\FFImageLoading.Transformations.dll</HintPath>
    </Reference>
    <Reference Include="Plugin.Permissions">
      <HintPath>..\..\packages\Plugin.Permissions.3.0.0.12\lib\xamarinios10\Plugin.Permissions.dll</HintPath>
    </Reference>
    <Reference Include="Plugin.Media">
      <HintPath>..\..\packages\Xam.Plugin.Media.4.0.1.5\lib\xamarinios10\Plugin.Media.dll</HintPath>
    </Reference>
    <Reference Include="System.Net.Http" />
    <Reference Include="Xamarin.Auth">
      <HintPath>..\..\packages\Xamarin.Auth.1.6.0.4\lib\Xamarin.iOS10\Xamarin.Auth.dll</HintPath>
    </Reference>
    <Reference Include="System.Json" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\APPNAME\APPNAME.csproj">
      <Project>{B1A336E0-3016-4315-8143-1ED508B427B2}</Project>
      <Name>APPNAME</Name>
    </ProjectReference>
  </ItemGroup>
  <ItemGroup>
    <Content Include="Resources\Brushed.png" />
    <Content Include="Resources\metal.png" />
  </ItemGroup>
  <ItemGroup>
    <BundleResource Include="Resources\icon.png">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </BundleResource>
  </ItemGroup>
  <ItemGroup>
    <Content Include="Resources\logo.png">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
  <Import Project="..\..\packages\Xamarin.Forms.3.4.0.1008975\build\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.3.4.0.1008975\build\Xamarin.Forms.targets')" />
</Project>

I am able to build and run a new xamarin iOS project.

How can I configure my project to allow me to run my iOS app?

2
is your iOS app set as the startup application in solution explorer?Jason
@Jason the iOS project is set to the startup project.Sam Borick
Also check your Info.plist has a Bundle Identifier set - I've noticed when that is blank that you cannot run the app.Conceptdev
Have you selected a iPhoneSimulator or a device before you run the project? If you choose Generic Device, then you can't run the project.Jack Hua

2 Answers

1
votes

Firstly, check in your Solution Options (right click on Solution -> Options or double click solution) if you have Build property checked on your iOS project: solution options check.

You might also find that the build property is checked, but the configuration is set to something other than Debug|iPhoneSimulator. You can edit the configuration to Debug|iPhoneSimulator by clicking on it: config

Secondly, on the bar select Debug | iPhone simulator, select the simulator you want to use and you should be ready.

1
votes

Check there's nothing listening on the debugger's port. Right click on you ios project => options => Build => ios Debug, then change the port to a different one.

enter image description here

I got the same error because i was running Azurite which uses the default debugger's 10000 for its blob storage. I changed it to a different for has in the screenshot and it started working again.