Page 1 of 1

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

Posted: 05 Dec 2023, 21:45
by ZioGio
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
    }
}

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

Posted: 06 Dec 2023, 10:20
by jsantos
"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".