How to fix "Root element is missing." when doing a Visual Studio (VS) Build?

Viewed 282316

How to fix "Root element is missing." when doing a Visual Studio (VS) Build?

Any idea what file I should look at in my solution?

Actually, I am getting this error message inside of "Visual Build Pro" when using using the "Make VS 2008" command. This command works just fine when building other solutions (like about 20) and I am not really sure why mine is getting the error.

Any help would be very much appreciated. :)

I am using VS 2008 and Visual Build Pro 6.7.

32 Answers

This error is caused by corrupted proj file.

Visual Studio always has backup project file at specific folder.

Please browse to:

C:\Users\<Your user>\Documents\Visual Studio <Vs version>\Backup Files\<your project>

You should see 2 files like this:

Original-May-18-2018-1209PM.<your project>.csproj
Recovered-May-18-2018-1209PM.<your project>.csproj

You only need copy file:

Original-May-18-2018-1209PM.<your project>.csproj

And re-name as

<your project>.csproj 

and override at root project folder.

Problem is solved!

My project did not load and gave me a Root Element Missingerror. I just deleted ****.csproj.user file and reloaded it again. The problem was solved this way

I had this issue running VS 2017, on build I was getting the error that the 'root element was missing'. What solved it for me was going to Tools > Nuget Package Manager > Package Manager Settings > General > Clear all Nuget Caches. After doing that I ran the build again and it was fixed.

In my case, .csproj was changed to encoded format. I did undo changes to csproj in Git(Team explorer) and reloaded the project file. This solved the problem.

In xamarin form project. I deleted

.VS Project folder.
ProjectName.Android.csProj.User
ProjectName.Android.csProj.bak

In my case, I just renamed the .csproj.user and restart the visual studio and opened the project. It automatically created another .csproj.user file and the solution worked fine for me.

In my case the problem occurred due to closing my PC while visual studio were remain open, so in result csproj.user file saved empty. Thankfully i have already backup, so i just copied all xml from csproj.user and paste in my affected project csproj.user file ,so it worked perfectly.

This file just contain building device info and some more.

No one of these solutions fixed my problem.

In my case, I finished my work and I shut down my computer. The day after I wasn't able to compile my project. I tried some of these solutions and I realized all my projects weren't work.

To Fix it, I reinstall .net core Framework.

Visual Studio 2017

In my case Microsoft.Common.CurrentVersion.targets was corrupted. I copied this file from other system and it worked.

Strangely "Root element is missing." also appears when no JDK was found.

Related