Roms6
Topic Author
Posts: 8
Joined: 10 Feb 2015, 18:53

NoesisException: Xaml not found in the built exe, running fine in play mode

06 Jun 2017, 00:50

Hello,

As said in the title, I'm encountering a weird behavior, and I can't tell if my lack of understanding is to blame :p

I've created two UserControl, one being named Home, another being named HomeNavigation. Both contain absolutely nothing complicated. Basically, Home is hosting HomeNavigation, and HomeNavigation contains text. The following is running fine in Unity Editor in play mode.

Home.xaml :
<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
	xmlns:ism="clr-namespace:Ism.View"
	x:Class="Ism.View.Home"
	d:DesignWidth="1920" d:DesignHeight="1080">

	<Grid x:Name="HomeLayout">
		<Grid.RowDefinitions>
			<RowDefinition />
		</Grid.RowDefinitions>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="500"/>
			<ColumnDefinition Width="1420"/>
		</Grid.ColumnDefinitions>

		<ism:HomeNavigation Grid.Column="0" Grid.Row="0" />

		<Grid x:Name="HomeFeed" Grid.Column="1" Grid.Row="0">

		</Grid>
	</Grid>
</UserControl>
Home.xaml.cs :
using Noesis;

namespace Ism.View
{
    public partial class Home : UserControl
    {
        public Home()
        {
            Initialized += Home_Initialized;
            InitializeComponent();
        }
        
        private void InitializeComponent()
        {
            GUI.LoadComponent(this, "Assets/Ism/View/Home.xaml");
        }

        private void Home_Initialized(object sender, EventArgs e)
        {

        }
    }
}
HomeNavigation.xaml :
<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
	xmlns:ism="clr-namespace:Ism.View"
	x:Class="Ism.View.HomeNavigation"
	d:DesignWidth="1920" d:DesignHeight="1080">

	<Grid>
		<TextBlock>Text</TextBlock>
	</Grid>
</UserControl>
HomeNavigation.xaml.cs :
using Noesis;

namespace Ism.View
{
    public partial class HomeNavigation : UserControl
    {
        public HomeNavigation()
        {
            Initialized += HomeNavigation_Initialized;
            InitializeComponent();
        }
        
        private void InitializeComponent()
        {
            GUI.LoadComponent(this, "Assets/Ism/View/HomeNavigation.xaml");
        }

        private void HomeNavigation_Initialized(object sender, EventArgs e)
        {

        }
    }
}
Once I build this and launch the exe, nothing is rendered, the error described in the output log is pretty clear : "NoesisException: Xaml not found 'Assets/Ism/View/HomeNavigation.xaml'". Except this is the actual location for this file... :(

Some help would be welcome, I'm using Unity 5.6.1p2 (64-bit) and my OS is Windows 10.
 
User avatar
jsantos
Site Admin
Posts: 2900
Joined: 20 Jan 2012, 17:18
Contact:

Re: NoesisException: Xaml not found in the built exe, running fine in play mode

06 Jun 2017, 15:27

You can fix this by applying the solution described in the Unity tutorial. UserControls enter the category of XAML loaded by code because for each user control your are loading the corresponding XAML manually. We should probably clarify this in the documentation.
private void InitializeComponent()
{
    GUI.LoadComponent(this, "Assets/Ism/View/Home.xaml");
}
 
Roms6
Topic Author
Posts: 8
Joined: 10 Feb 2015, 18:53

Re: NoesisException: Xaml not found in the built exe, running fine in play mode

06 Jun 2017, 17:50

Thanks. I preloaded them through NoesisSettings :)
 
User avatar
jsantos
Site Admin
Posts: 2900
Joined: 20 Jan 2012, 17:18
Contact:

Re: NoesisException: Xaml not found in the built exe, running fine in play mode

07 Jun 2017, 09:23

Marking as solved. Thanks for the feedback!

Who is online

Users browsing this forum: No registered users and 1 guest