I just created a new WPF project, but I decided to make a different organization of the folders, to make them look like this:

So I want all my interfaces to be on src folder. But when I press F5 and try to run it, the debugger says it can’t find MainWindow.xaml. The xaml look like this:
App.xaml
<Application x:Class="MyNamespace.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
MainWindow.xaml
<Window x:Class="MyNamespace.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
</Grid>
Apparently they share the same namespace, but it’s not finding the MainWindow.xaml… Any idea why?
App.xaml.cs
namespace MyNamespace.src
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
MainWindow.xaml.cs
namespace MyNamespace
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}
Your
MainWindowis in the the"src"folder.The
StartupUriis relative to the structure of your project.So
StartupUri = "src\MainWindow.xaml"should work.