I am following this tutorial here: https://prismlibrary.com/docs/wpf/getting-started.html
It first modifies the class used in App.xaml as follows:
<prism:PrismApplication
x:Class="WpfApp1.App"
...
xmlns:prism="http://prismlibrary.com/">
...
</prism:PrismApplication>
Then, in the App.xaml.cs code-behind file, it derives the App
class from class PrismApplication
(replacing the standard WPF Application
class) like so:
public partial class App : PrismApplication
...
When I replicated the above steps, I got the following error:
CS0263 Partial declaration of 'App' must not specify different base classes
Looking up the error, I came across the following answer: https://stackoverflow.com/a/40616616/ which says that you need only specify the base class in one of the partial class declaration files, and that usually, the specification in the code-behind file is unnecessary.
Accordingly, I changed the partial class definition in the code-behind file as follows:
public partial class App
And sure enough, the error went away.
My question: Since PrismApplication
is obviously not the correct way to specify the base class name in the code-behind file for the above case (corresponding to prism:PrismApplication
), what is?
Official samples do explicit inheritance from base class in .xaml.cs like this. Try deleting bin and obj folders of your project as suggested here, it might resolve the issue.