How to fix “Root element is missing.” when doing a

2019-01-14 10:10发布

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.

26条回答
做自己的国王
2楼-- · 2019-01-14 10:37

Make sure any XML file (or any file that would be interpreted as an XML file by visual studio) has a correct XML structure - that is, one root element (with any name, I have use rootElement in my example):

<?xml version="1.0"?> 
<rootElement>
 ...
</rootElement>
查看更多
看我几分像从前
3楼-- · 2019-01-14 10:37

I got this issue on a Web API project. Finally figured out that it was in my "///" method comments. I have these comments set to auto-generate documentation for the API methods. Something in my comments made it go crazy. I deleted all the carriage returns, special characters, etc. Not really sure which thing it didn't like, but it worked.

查看更多
祖国的老花朵
4楼-- · 2019-01-14 10:37

I had a few massive VS2015 Community crashes.

Delete all the .csproj.user files

which were full of null characters, and also these

C:\Users\UserName\AppData\Local\Temp\

.NETFramework,Version=v4.0.AssemblyAttributes.cs .NETFramework,Version=v4.5.AssemblyAttributes.cs .NETFramework,Version=v4.5.2.AssemblyAttributes.cs

查看更多
啃猪蹄的小仙女
5楼-- · 2019-01-14 10:37

In my case, i was using vs 2010 with crystal report. Innerexception revealed root element is missing error. Go to directory like C:\Users\sam\AppData\Local\dssms\dssms.vshost.exe_Url_uy5is55gioxym5avqidulehrfjbdsn13\1.0.0.0 which is given in the innermessage and make sure user.config is proper XML (mine was blank for some reason).

查看更多
beautiful°
6楼-- · 2019-01-14 10:39

In my case the RDLC files work with resource files (.resx), I had this error because I hadn't created the correspondent resx file for my rdlc report.

My solution was add the file .resx inside the App_LocalResources in this way:

\rep
\rep\myreport.rdlc
\rep\App_LocalResources\myreport.rdlc.resx
查看更多
够拽才男人
7楼-- · 2019-01-14 10:40

I had the same problem in a Xamarin Forms project. iOS project was unavailable and I couldn't reload the project. I was looking for a solution that doesn't need uninstalling anything.

The answer I got from this blog: https://dev.to/codeprototype/xamarin-form-application-failed-to-load-android-project-root-element-missing--27o0

So without uninstalling anything, you could delete the .csproj.user file (or rename it) so Visual Studio will create the file again. Worked for me twice.

查看更多
登录 后发表回答