2

Trying to convert my existing project to MVVM, I created a new solution with 3 projects : M, VM and V.

When adding my user controls to the new project I added the .cs files only and not the xaml. Compiled the solution and realized my problem so i removed the files and the xaml individual so I got both.

Now however when I build, I get. "Data at the root level is invalid. Line 1, position 1. XML is not valid." and it lists the associated .cs file as the file it tried to parse. This happens for ALL of my XAML files.

I'm looking for a solution that does not have me recreate everything. Is there a config file that specifies what should be parsed?

2
  • Properties => Build Action. Create a new WPF project and examine the build actions for the different file types. Go back to your other project and make sure they match. Commented Sep 23, 2016 at 19:30
  • 1
    That was it. My .cs files that were associated with the .xaml files were set to page instead of compile. Thanks! Commented Sep 23, 2016 at 20:15

2 Answers 2

3

Sounds like your build actions are not configured correctly. .XAML files should have a build action of Page, and .cs files should have a build action of Compile.

You can configure the build action by opening the Properties tool window and selecting the file in Solution Explorer. Build Action is typically the first option on the Properties page.

Sign up to request clarification or add additional context in comments.

Comments

0

You might be missing or the format is not valid in the first line

<?xml version="1.0" encoding="UTF-8" ?>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.