This is a simple problem that someone surely knows how to solve.
I have a WPF application that compiles perfectly fine.
I decided to add functionality to the ListView, so I extended the ListView class as ListViewEx.
I went into my XAML code and changed all the ListView tags to ListViewEx.
Now the application will not compile, claiming ListViewEx does not exist. But it doesn't exist, because it hasn't been compiled yet, and it won't compile because the XAML doesn't think it exists yet!
The only way I can get it to compile is to completely remove all tags referencing the new class from the XAML, compile the project so the new class exists whereever the XAML is looking for it, and then I can add the tags back and it will compile fine.
Is this behavior by design?
Notice four things.
- ListViewEx does in fact exist in the FilePublisher namespace. (contradicts error message)
- The MainForm's XAML declare the FilePublisher namespace as "p"
- "p:ListViewEx" is referenced in the XAML
- lstFile does exist in MainForm (see XAML tag Name="lstFiles") (contradicts error message)
The problem is that the XAML designer is referencing the DLL it's trying to compile. It's expecting ListViewEx to already exist, and because it hasn't been compiled yet, it does not exist in the DLL. As a result, the designer is not automatically generating the lstFiles property on the main form's partial class like it should, and as a result, the project will not compile because the code references lstFiles. So it won't compile, because something doesn't already exist in the very thing it's trying to compile! That is a circular dependency, and it's reproducible 100% of the time.