Travis Pettry
Travis Pettry

Reputation: 1352

Uno Random Compile Errors

I have created a brand new Uno project and off the bat I get compile errors. I most common one I am getting is a cs 1061 App does not contain a definition for InitializeComponent. The app would run with this error, but once I start adding more pages to the application, the application no longer compiles. How do I resolve this issue? Also, I get this same error for each page that I add. The oddest part about this issue is that the app.xaml.cs suffers from it too.

I am also getting a XLS0411 that is complaining about the background brush that comes with the default page. <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

Upvotes: 0

Views: 385

Answers (1)

David Oliver
David Oliver

Reputation: 2321

The message about InitializeComponent() is a false positive from Visual Studio, this is a known issue. The Uno Platform documentation recommends to build the project once, close the solution, and then reopen it to get rid of this error.

In general the Error window is less useful with Uno Platform projects because of the various false positives, it's more reliable to check the Build pane in the Output window. The Error window is Intellisense's best guess as what errors your code may have; the Build output is what actually happened when it tried to compile. If you search for "error " from the top of the Build output you should quickly find the reason the compilation failed; this will tell you why it's failing when you add pages to the application.

Upvotes: 3

Related Questions