XAML Unnumbered Error "Undefined CLR namespace. The 'clr-namespace' URI ....

This forum is meant for questions and discussions about the X# language and tools
Post Reply
User avatar
AlwynJB
Posts: 31
Joined: Tue Jan 17, 2017 2:25 pm

XAML Unnumbered Error "Undefined CLR namespace. The 'clr-namespace' URI ....

Post by AlwynJB »

Hi.
Error text: "Undefined CLR namespace. The 'clr-namespace' URI refers to a namespace 'WPF_3D_Test_1' that could not be found.
The Error List shows no Error Number.

The header of many of my Windows includes the following lines:
<Window x:Class="WPF_3D_Test_1.Window1"
xmlns:Local="clr-namespace:WPF_3D_Test_1"

and all the PRG files quote this same namespace name. This of course prevents calling Converter methods, etc. And because of 'Invalid Markup' I cannot view the XAML window designer.

This error is intermittent and I can't determine what causes it to appear or disappear! I used to get a similar error in VN some time ago too.

Alwyn

BUT I do like X# very much. I have used "BEGIN USING..." wherever I had called Dispose(). And, of course, found that I hadn't always called Dispose() in the VN version where I should have.
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

XAML Unnumbered Error "Undefined CLR namespace. The 'clr-namespace' URI ....

Post by Chris »

Hi Alwyn,

To hard to say what's the problem, a quick google for this error message shows a lot of results. Any chance you can zip and send the solution so we can have a look?

Is it a vulcan app that used to work and now throws this error, without any other changes? One very long shot that comes in mind, maybe the "Prefix classes with default namespace" project option is not enabled, so the classes do not get that namespace as you might expect?

Chris
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
User avatar
AlwynJB
Posts: 31
Joined: Tue Jan 17, 2017 2:25 pm

XAML Unnumbered Error "Undefined CLR namespace. The 'clr-namespace' URI ....

Post by AlwynJB »

Hi Chris,
(You were working late again!)
It is a converted VN app. I think I got similar errors in Vulcan sometimes.
I could Zip it and upload it via Dropbox. But it's a big Project to search through!
I think that sometimes it clears itself when I close and reopen VS. But it comes back.

I'll do further Google searches first. (I have tried.)

Thanks so far.

Alwyn
User avatar
AlwynJB
Posts: 31
Joined: Tue Jan 17, 2017 2:25 pm

XAML Unnumbered Error "Undefined CLR namespace. The 'clr-namespace' URI ....

Post by AlwynJB »

Hi Chris again,
I note that back in 2009 people were saying that changing the Solution Platform from any CPU to x86 solved this problem. That on it's own didn't work for me
The Configuration Manager has a drop-box for Active solution platform which is what I changed above.
But my solution has 2 Projects whose Platforms are still shown as 'Any CPU'. (So changing the solution platform doesn't change its projects?)
My problem Project has the same name as the Solution.
Trying to change that Project to x86 I got a message saying 'This platform could not be created because a solution platform of the same name already exists'.
I have found descriptions of how to change a Project name but they all seem to end up changing the Solution name to the same name. That would seem to defeat the object.
Any ideas?
Alwyn
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

XAML Unnumbered Error "Undefined CLR namespace. The 'clr-namespace' URI ....

Post by Chris »

Hi Alwyn,

The name of the solution should not have any impact. About the platform, what you need to do is go to every project properties, Build page and set the Platform Target to x86. Do that for all projects and for both configuareations (Release/Debug), so you are sure you are building in x86 mode.

Btw, vulcan did not have this, vulcan could only compile in x86 mode, so you did not need to deal with this.

Chris
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
User avatar
AlwynJB
Posts: 31
Joined: Tue Jan 17, 2017 2:25 pm

XAML Unnumbered Error "Undefined CLR namespace. The 'clr-namespace' URI ....

Post by AlwynJB »

Thanks Chris,
I've just done as suggested. I found that the Project Properties windows showed x86 already. (But the Configuration Manager still showed the Projects were in Any CPU state.)

But this didn't solve the problem. The app runs after building but the windows still show wobbly blue underlining in the same places and the design is not shown.

The fact that I sometimes saw similar underlining in VN (x86) suggests that the above change would be irrelevant.

I'll leave the Projects in x86 state until I find it works, then try upgrading to Any CPU.

I'll do more research before troubling you with a Zip file.

Alwyn
User avatar
AlwynJB
Posts: 31
Joined: Tue Jan 17, 2017 2:25 pm

XAML Unnumbered Error "Undefined CLR namespace. The 'clr-namespace' URI ....

Post by AlwynJB »

Hi Chris again,

Thanks again. Not solved yet.
But I note that Error list shows 3 Errors (without codes) and 3 Warnings while the Compiler Output shows 0 Errors and 6 Warnings. It runs. The only real disadvantage is not being able to edit or inspect the XAML designer window.
The 3 Errors are the same as before.

You could close this topic. But I'll probably come back to it. If I find a solution to the problem I'll let you know.

Alwyn
User avatar
robert
Posts: 4225
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

XAML Unnumbered Error "Undefined CLR namespace. The 'clr-namespace' URI ....

Post by robert »

Alwyn,
I know that some things in VS are quite confusing. The Configuration and Platform values for a solution are one of these. These are really just names. You are free to choose any name, but usually there are Debug and Release for Configuration and AnyCPU, x86 and X64 for the Platform.
These names have no direct connection with the actual values for Platform and Debug in the projects themselves.
So you could set the Debug configuration to compile without debug info and without pdb and the Release configuration with debug and pdb. That does not make sense but is technically possible.
When you have a project with C++ code then the x86 and x64 platforms are quite common because different code is generated for these platforms. For a managed project usually AnyCPU is chosen.
In a mixed solution with both C#/X# and C++ code you could have a solution platform x86 where for the C++ project really x86 output is generated but for the C#/X# project the output could still be AnyCPU.
In our runtime solution we have added a 3rd configuration: "documentation". When you build this configuration then the XML doc file is generated.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
AlwynJB
Posts: 31
Joined: Tue Jan 17, 2017 2:25 pm

XAML Unnumbered Error "Undefined CLR namespace. The 'clr-namespace' URI ....

Post by AlwynJB »

Thanks Robert,

But I'm not much the wiser! I guess it will get clearer with progress.

Alwyn
Post Reply