'The call between InitializeComponent(); is ambiguous?

My error is:

Error 4 The call is ambiguous between the following methods or properties: 'Grub2._0.Time.InitializeComponent()' and 'Grub2._0.Time.InitializeComponent()'

Here is my code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;

namespace Grub2._0
{
    public partial class Time2 : PhoneApplicationPage
    {
        public void Time2.()
        {
            InitializeComponent();
        }


        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (AMRadioButton.IsChecked == true)
                NavigationService.Navigate(new Uri("/PolicemanFood.xaml", UriKind.Relative));
            else if (PMRadioButton.IsChecked == false)
                NavigationService.Navigate(new Uri("/Weed.xaml", UriKind.Relative));
            else
                NavigationService.Navigate(new Uri("/BurgerKing.xaml", UriKind.Relative));
        }
    }
}


Solution 1:[1]

Try this code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;

namespace Grub2._0
{
    public partial class Time2 : PhoneApplicationPage
    {
        public Time2()
        {
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (AMRadioButton.IsChecked == true)
                NavigationService.Navigate(new Uri("/PolicemanFood.xaml", UriKind.Relative));
            else if (PMRadioButton.IsChecked == false)
                NavigationService.Navigate(new Uri("/Weed.xaml", UriKind.Relative));
            else
                NavigationService.Navigate(new Uri("/BurgerKing.xaml", UriKind.Relative));
        }
    }
}

Removed the void keyword and period after Time2 on the constructor.

Solution 2:[2]

I met this proplem when I put 2 wpf projects in one solution which shares some libs, and then open the 2 at the same time. Seems the 2 visual studio instance want generate code for the 2 exe at the same time, which causes conflicts.

Closing one of them solves the problem.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 cheny