Pages

Saturday, 26 May 2018

Initializecomponent doesnot exist in xamarin forms visual studio 2017

Hi Developers, there is various solution whatever suits you try down from the list: -

Solution 1: R.Click the Solution file and select Clean Code. Once solution cleaned succeeded. R.Click the solution and select Build Solution.

Solution 2: Close the project and Re-open the same project using File -> Open project -> Select Solution file (.sln). Clean and Build Solution.



Solution 3: Re-build solution will sometime remove the error.

Solution 4: Update Xamarin.Forms package from NuGet package manager. To do so Goto the Menu bar, select Tools TAB -> Select NuGet Package Manager -> Select Manage NuGet Packages for Solutions -> Under Updates TAB select Xamarin.Forms -> Check All Mobile O.S. and click on Install button.

Solution 5: MyProject.projitems: Open project in File Explorer there you will find a file whose extension is .projitems. Open the file in notepad.
Now, change the code layout as below:

For Example:

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
    <HasSharedItems>true</HasSharedItems>
    <SharedGUID>00000-00000-00000-00000-00000</SharedGUID>
  </PropertyGroup>
  <PropertyGroup Label="Configuration">
    <Import_RootNamespace>DemoXamarin</Import_RootNamespace>
  </PropertyGroup>
  <ItemGroup>
    <EmbeddedResource Include="$(MSBuildThisFileDirectory)App.xaml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="$(MSBuildThisFileDirectory)App.xaml.cs">
      <DependentUpon>App.xaml</DependentUpon>
    </Compile>
    <Compile Include="$(MSBuildThisFileDirectory)Model\Employee.cs" />      
    <Compile Include="$(MSBuildThisFileDirectory)MainPage.xaml.cs">
      <DependentUpon>MainPage.xaml</DependentUpon>
      <SubType>Code</SubType>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="$(MSBuildThisFileDirectory)MainPage.xaml">
      <SubType>Designer</SubType>
      <Generator>MSBuild:Compile</Generator>
    </EmbeddedResource>
  </ItemGroup>
</Project>


Hope you find the article helpful & interesting.


For any query, comment us below.

Previous – What is Xamarin?


Click imagination hunt to read latest blogs.


Keep learning and sharing...

No comments:

Post a Comment