I'm using the WAF-Framework for building a MVVM-Application. I got my own App-Class (App.xaml and App.xaml.cs).
Everytime I try to compile my application I get 3 different error messages:
MyApplication.Presentation.App already defines a member
InitializeComponent with same types of parametersMyApplication.Presentation.App already defines a member Main with same types of parametersMyApplication.Presentation.App already contains a definition for _contentLoaded When I click on the error-message I get redirected to a file called App.g.cs. If I then remove everything within this file, my application will be build and everthings works as wished. But after another change the file is back and I would have to delete it again.
I checked all my files and I can't find another definition of these 3 members. I don't have another Main-Method anywhere. I also tried to rename my Application but this didn't solve the problem.
Any suggestions what I could do to solve this annoying problem?
I had something very similar recently, and it turned out that when importing existing code files I had imported the obj directory itself!

This directory contained, for example, the auto-generated (and automatically imported) MainWindow.g.i.cs file. So I was effectively including the same partial class definition twice, hence the "already defined" errors.
Excluding this folder from the project and rebuilding the solution works to resolve the errors.
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