ZioGio
Topic Author
Posts: 2
Joined: 01 Nov 2023, 17:46

error CS0246: The type or namespace name 'Window' could not be found

05 Dec 2023, 21:45

Full error: error CS0246: The type or namespace name 'Window' could not be found (are you missing a using directive or an assembly reference?)

This issue was briefly touched in Noesis forum post viewtopic.php?p=11899&hilit=CS0246#p11899, but there was no solution provided.

I need to use a WPF Window with Noesis and Unity; a UserControl won't work in my current scenario. Is this a known issue? Is there a workaround?

There is no parser error in Visual Studio 2019. The error only comes up in Unity 2022.3.4f1. I do not know if this issue is resolved in later versions of either Visual Studio or Unity; I'm restricted to those versions. We're also using Noesis.GUI.Extensions 3.0.24.

Thank you for your time and assistance!
#if UNITY_5_3_OR_NEWER
#define NOESIS
using Noesis;
#else
using System.Windows;
#endif

namespace WPFApp1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

#if NOESIS
        private void InitializeComponent()
        {
            NoesisUnity.LoadComponent(this);
        }
#endif
    }
}
 
User avatar
jsantos
Site Admin
Posts: 3925
Joined: 20 Jan 2012, 17:18
Contact:

Re: error CS0246: The type or namespace name 'Window' could not be found

06 Dec 2023, 10:20

"Window" is not available on Unity because it is not possible to create operating system windows there. You can use "Page" or any other common container like "Grid" or "Canvas".

Who is online

Users browsing this forum: Bing [Bot] and 4 guests