I have a very simple wpf app I built to demo a class library I built, but I am coming up on some strange behavior:
xmlns:lcl="clr-namespace:testApp;assembly=testApp"
This above is the important line, but I am including everything to be complete.
<Window x:Class="testApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:lcl="clr-namespace:testApp;assembly=testApp"
xmlns:evt="clr-namespace:EventToCommand;assembly=EventToCommand"
Title="MainWindow" Height="350" Width="525">
<Window.DataContext>
<lcl:ViewModel />
</Window.DataContext>
<Label Name="lblOutput" VerticalAlignment="Center" HorizontalAlignment="Center" Content="{Binding labelOutput}" />
</Window>
When I include the assembly, the designer works, and the binding on the label text works properly. However, when I go to build and run the program, I get the following error:
Error 1 The tag 'ViewModel' does not exist in XML namespace 'clr-namespace:testApp;assembly=testApp'
When I remove the assembly portion of that line, the designer stops showing me anything, but the program builds and runs perfectly.
What is going on and how do I stop it?
EDIT:
Here is the top of the AssemblyInfo.cs file to show that that is the correct name:
[assembly: AssemblyTitle("testApp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("testApp")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
Try changing the reference xmlns:lcl="clr-namespace:testApp;assembly=testApp" to xmlns:lcl="clr-namespace:testApp" .
When classes are in the same project view, it is not necessary to use "assembly="
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.