Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

the name <...> does not exist in the namespace clr-namespace <...>

I have a small WPF application which used to compile just fine but is not anymore. I can't really say at which point it stopped building. It just worked fine one day, and the next it's not.

Here's the project structure:

enter image description here

There is no other projects or external references other than standard .net dlls.

Here's the user control where the problem originated:

<UserControl x:Class="TimeRecorder.HistoryUserControl"          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"          xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"           xmlns:local="clr-namespace:TimeRecorder.ViewModel"          xmlns:framework="clr-namespace:TimeRecorder.Framework"          mc:Ignorable="d" Height="Auto" Width="Auto" Padding="5"> <UserControl.Resources>     <local:HistoryViewModel x:Key="ViewModel"/>     <framework:BoolToColorConverter x:Key="ColorConverter"/> </UserControl.Resources> <StackPanel DataContext="{StaticResource ViewModel}"> 

And here's the error I get: http://i48.tinypic.com/5u1u8w.png

Please note that this is not just the one file in the screenshot, but all references I add in similar fashion in xaml in all user control/window files in this project.

So the file is there, the namespace in the file is correct, the namespace/class name in the xaml file is (to my understanding) correct. I get intellisense when I type in the xaml so it finds the files ok then but not when it compiles.

The most common solution for this in other posts has been the .net framework version. It is currently set to .Net Framework 4 for both my main and test project. The full version not the client profile.

Here's what I think I messed up: In the configuration manager, both projects have their Platform set to Any CPU, but at one point when trying to solve this I noticed that the main project was set to x86 and the test project was set to Any CPU. So I added Any CPU manually for the main project in the configuration manager. However I honestly don't know if I did this correctly or even if I should do it. So as an additional question, is there a way I can reset the configuration manager to its default state? Will this have anything to say for the main problem? I don't know if the main project was always set to x86 or not or if I somehow changed it to x86 and then it broke. As mentioned this project was compiling just fine for a while.

like image 832
ardal Avatar asked Feb 24 '13 11:02

ardal


People also ask

What is CLR namespace?

clr-namespace: The CLR namespace declared within the assembly that contains the public types to expose as elements. assembly= The assembly that contains some or all of the referenced CLR namespace. This value is typically just the name of the assembly, not the path, and does not include the extension (such as .


1 Answers

Every time it happend to me i just restarted visual studio, re-built the solution and it worked just fine.. can't say why

like image 82
gil kr Avatar answered Oct 15 '22 14:10

gil kr