Page 1 of 1

xaml x:Name on UserControl results in compiler error

Posted: 12 Aug 2021, 20:53
Why does this fail in error in the "Blend"-project?
<local:Search x:Name="search" />
Severity Code Description Project File Line Suppression State
Error CS0234 The type or namespace name 'Assets' does not exist in the namespace 'SystemTwo.Assets.Scenes.SystemTwo' (are you missing an assembly reference?) SystemTwo-blend C:\Projects\Unity\Noesis\SystemTwo 0.4\SystemTwo\Assets\Scenes\SystemTwo\Scripts\NoesisGUI\CaseView.xaml 28 Active

If I just leave out the name and write
<local:Search />
it works just fine.

This only results in error when I run the Blend-project (In VS, have not tried Blend), if I run the same code with Unity with the Noesis VS-project it works fine.

For now I don't even use the "search" name reference, which is also why it took me a long time to figure out that the reference was the problem.

Steps to reproduce:
Create whatever container xaml file and include a Usercontrol and put x:Name on the xaml referenceobject inside the container.

Re: xaml x:Name on UserControl results in compiler error

Posted: 12 Aug 2021, 20:55
I have been made aware that this is not specific to Noesis : https://stackoverflow.com/questions/335 ... tion-error

Re: xaml x:Name on UserControl results in compiler error

Posted: 12 Aug 2021, 21:06
by sfernandez
Was that answer from stackoverflow the source of your problem?

Re: xaml x:Name on UserControl results in compiler error

Posted: 17 Aug 2021, 11:32
Was that answer from stackoverflow the source of your problem?
Kinda yes, I think my problem was that I had two folders with the same name in the path. I didn't exactly change the name of the folder to fix it, I completely changed path and that solved it.

Re: xaml x:Name on UserControl results in compiler error

Posted: 17 Aug 2021, 11:50
by sfernandez
Ok, thanks for sharing the solution here.