When I create Wpf project, I get default App
class which is derived from Application
.
I want to derive App
from my own class (which of course inherits Application
), but there is autogenerated App.g.cs
file which define that App
is derived form Application
.
How can I turn off that autogenerated file?
Change the <Application
tag in App.xaml to <local:YourClass xmlns:local="clr-namespace:Your.Namespace"
Alternatively, get rid of App.xaml and create the entire class yourself.
When creating your own class derived from Application set the build action to ApplicationDefinition:
"Identifies the XAML markup file that contains the application definition (a XAML markup file whose root element is Application). ApplicationDefinition is mandatory when Install is true and OutputType is winexe. A WPF application and, consequently, an MSBuild project can only have one ApplicationDefinition."
Extract From msdn link
To turn off the creation of the autogenerated app.g.cs change the build action from "ApplicationDefinition" to "Page" and substitute your own entry point into the app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With