简体   繁体   中英

The name “Classname” does not exist in the namespace “using:company.name.app”

I converted my Windows 8.1 app to UWP app. After this I can't use my xaml designer any more in Visual Studio 2015 Update 1. I always got the error: The name "Classname" does not exist in the namespace "using:company.name.app" .I got this error on all pages and with different classes. But if I compile the app is running.

What I do:

  • I changed all my namespaces to the root Namespace
  • Tried xmlns:common="clr-namespace:=company.name.app"
  • Closed VS und run with admin rights
  • Deleted obj folder
  • Switched to different targets x64, x86, Any CPU
  • Clean und rebuild solution

but it didn't solve the problem?

<Page x:Name="pageRoot"
x:Class="company.name.app.MainItemsPage"
DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:common="using:company.name.app">

<Page.Resources>
    <common:Time x:Key="timeSource"/>
    <common:Weather x:Key="weatherSource"/>
</Page.Resources>

And the class in the same namespace:

namespace company.name.app {

public partial class Time : INotifyPropertyChanged {

    private readonly DispatcherTimer timer = new DispatcherTimer();
    private string resDateTime;

    public string ResDateTime {
        get {
            return resDateTime;
        }
        set {
            resDateTime = value;
            NotifyPropertyChanged("ResDateTime");
        }
    }

    public event PropertyChangedEventHandler PropertyChanged;

    public void NotifyPropertyChanged(string propertyName) {
        if (PropertyChanged != null) {
            PropertyChanged(this,
                new PropertyChangedEventArgs(propertyName));
        }
    }

    public Time() {
        timer.Tick += TimerOnTick;
        timer.Start();
    }
  }
}

Its difficult for us to say from the information above, if you could share more of the project we can try to assists. The best guess is you have an implicit assembly reference somewhere that the designer can't resolve.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM