programing

"루트 요소가 없습니다."수정 방법

nasanasas 2020. 12. 3. 08:00
반응형

"루트 요소가 없습니다."수정 방법 Visual Studio (VS) 빌드를 수행 할 때?


"루트 요소가 없습니다."수정 방법 Visual Studio (VS) 빌드를 수행 할 때?

내 솔루션에서 어떤 파일을보아야하는지 아십니까?

실제로 "Make VS 2008"명령을 사용할 때 "Visual Build Pro"내부에이 오류 메시지가 표시됩니다. 이 명령은 다른 솔루션 (예 : 약 20 개)을 빌드 할 때 잘 작동하며 왜 내 오류가 발생하는지 잘 모르겠습니다.

어떤 도움이라도 대단히 감사하겠습니다. :)

VS 2008 및 Visual Build Pro 6.7을 사용하고 있습니다.


모든 XML 파일 (또는 Visual Studio에서 XML 파일로 해석되는 모든 파일)이 올바른 XML 구조를 가지고 있는지 확인합니다. 즉, 하나의 루트 요소 (모든 이름을 가진, rootElement내 예제에서 사용 했습니다)가 있습니다.

<?xml version="1.0"?> 
<rootElement>
 ...
</rootElement>

제 경우에는 충돌 후 문제를 일으킨 xxxxxxxxxxxx.vcxproj.user 파일이었습니다 (비어 있음). 이름을 바꾸고 문제가 해결되었습니다.


BOM이 충돌하면 '루트 요소가 없습니다'라는 메시지도 표시됩니다. :). BOM = 바이트 주문 표시. 잘못된 인코딩으로 저장 될 때 파일 시작 부분에 추가되는 추가 문자입니다.
이것은 XML 파일로 작업 할 때 Visual Studio에서 때때로 발생할 수 있습니다. 코드를 작성하여 모든 파일에서 제거하거나 어떤 파일인지 알고있는 경우 Visual Studio에서 특정 인코딩 (utf-8 또는 ascii IIRC)으로 저장하도록 강제 할 수 있습니다.

VS 이외의 편집기에서 파일을 열면 (notepad ++ 시도) <? 앞에 두 개의 재미있는 문자가 표시됩니다. xml 선언.

VS에서이 문제를 해결하려면 VS에서 파일을 연 다음 VS 버전에 따라

  • 파일> 고급 저장 옵션> 적절한 인코딩 선택
  • 파일> 다른 이름으로 저장> 파일 이름 유지, 저장 버튼 오른쪽에있는 드롭 다운 화살표를 클릭하여 인코딩 선택

제 경우에는 파일을 가리키는 누락 요소 오류가 발생했습니다NuGet.Config . 당시에는 이런 모습 이었어요

<?xml version="1.0" encoding="utf-8"?>
<settings>
  <repositoryPath>Packages</repositoryPath>
</settings>

그런 다음 configuration실제로 전체 xml을 래핑하는 태그를 추가했습니다 . 이제 잘 작동합니다.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <settings>
     <repositoryPath>Packages</repositoryPath>
  </settings>
</configuration>

이 오류는 손상된 proj 파일로 인해 발생합니다.

Visual Studio에는 항상 특정 폴더에 백업 프로젝트 파일이 있습니다.

다음으로 이동하십시오.

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

다음과 같은 2 개의 파일이 표시되어야합니다.

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

복사 파일 만 필요합니다.

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

그리고 다음으로 이름 변경

<your project>.csproj 

루트 프로젝트 폴더에서 재정의하십시오.

문제가 해결되었습니다!


같은 오류가 발생했습니다. 오류 표시 Microsoft.Data.Entity는 루트 요소 누락을로드 할 수 없습니다. C : \ Windows \ Microsoft.NET \ Framework \ v4.0.30319에서 해당 파일을 삭제하고 내 솔루션을 다시 열면 문제가 해결되었습니다. 모든 게 괜찮아


제 경우에는 .csproj파일을 열었을 때 파일이 비어 있었으므로 git의 이전 커밋으로 이동하여 해당 파일의 내용을 복사하여 현재 .csproj파일에 붙여 넣었습니다 . 그 후 .csproj.user파일을 삭제하고 프로젝트를 다시로드 하면 모든 것이 다시 작동하기 시작했습니다.


제 경우에는 파일 C:\Users\xxx\AppData\Local\PreEmptive Solutions\Dotfuscator Professional Edition\4.0\dfusrprf.xml이 NULL로 가득 차있었습니다.

나는 그것을 삭제했다; Dotfuscator가 처음 출시 될 때 재현되었으며 그 후 정상 성이 복원되었습니다.


파일을 검색 할 수도 있습니다. PowerShell을 사용하여 프로젝트 디렉터리로 이동하고 Get-FileMissingRoot를 실행합니다.

function Get-FileMissingRoot {

    dir -recurse |
        where {
            ($_ -is [IO.FileInfo]) -and 
            (@(".xml", ".config") -contains $_.extension) 
        } |
        foreach {
            $xml = New-Object Xml.XmlDocument;
            $filename = $_.FullName
            try {
                $xml.Load($filename)
            }
            catch {
                write ("File: " + $filename)
                write ($_.Exception.Message)
            }
        }
}

This error can sometimes occur when you edit some Project Toolchain settings Atmel Studio 6.1.2730 SP2.

In my case I tried to edit Project Properties > Toolchain > Linker > General settings with 'All Configurations' selected in the Configuration. When I checked or unchecked a setting, a dialog with the error popped up. However, I found that I could make the same edits if I made them to only one build configuration at a time; i.e. with only 'Debug' or 'Release' selected instead of 'All Configurations'.

Interestingly, I later was able to edit the same Linker settings even with 'All Configurations' selected. I don't know what changed in my project that made this possible.


I had Blue Screen while running Visual Studio 2013, when I Restart I intended to run again my project, but I had always this headius Error. anyway

Deleting The Folders with the Temp info Fix this problem. in my case the Project was a Windows Server, and Basically it Creates a Folder with some Tem info.

the folder was

C:\Users\User_NAME\AppData\Local\NAme_OF_THeProject

inside Exist a Folder with the Name of the Project+ some Generated GUI Service.ServerHostLoader_Url_u2jn0xkgjf1th0a3i2v03ft15vj4x52i

this is the Folder I deleted and now I can run again the Project.


In my case I upgraded to VS2017 and wanted to build all projects with MSBuild 4 with my build script (which had been using MSBuild 3.5 when we were using VS2015). That MSBuild upgrade appeared fine for the Windows desktop applications but the ones for Windows CE with compact framework would give me this confusing error. Reverting to MSBuild 3.5 for Windows CE projects fixed the issue for me.

I did have the BOM in .csproj files by the way and removed them for all projects in a solution that would not build but that did not help.


In my case I received a message like this: See this picture

I just commented the snipped code below in the project file (.csproj) and the problem was fixed.

<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

In my case xxxx.pubxml.user was not loaded when tried to publish the application. I deleted the file and restart the Visual studio then created a new profile to publish it, problem is solved and published successfully.


Hey, I have the same issue on Mac working on a Cocoa C# solution. (But I solved it !)

It always say that the root element is missing so it cannot load my C# project file.

I have the 2017 Visual Studio Mac Community Edition. I finally managed to find a solution after several hours (painful!).

My solution is because the frameworks related to the Visual Studio are old or broken. I found this because I tried to create a new Mac solution by Cocoa and it said "failed to save the solution". Then, I tried to create an Android Solution and it is working fine. Go to your "Finder" and "Go" -> "Go to a Folder" then go to the "Library/Frameworks". I have deleted mono.framework and frameworks related to Xamarin because I believe these Xamarin frameworks are broken.

Then, uninstalled the Visual Studio and reinstalled it. Now everything works fine!


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 xamarin form project. I deleted

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

Ho i simply solved this issue by going to source control explorer and selected the issue project, right clicked and selected the option Get Specific Version under Advanced menu. And then selected Type as Latest Version and ticked following two check boxes and clicked Get button. Then i refreshed the solution and my project came back to live and problem gone. Please note that This may overwrite your local projects so your current changes may lose. So if you dont have any issues with your local copy then you can try this. Hope it helps


This was easy to fix than I thought. All I did was clear the website cache folder.

Delete everything from

DRIVE LETTER OF OS:\Users\USER NAME\AppData\Local\Microsoft\WebsiteCache

example

C:\Users\Jack\AppData\Local\Microsoft\WebsiteCache

For more visual studio tips please visit My Blog


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.


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

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


In my case, I got this error because of an empty packages.config file. This caused the NUGET package manager to fail and show the error Root element is missing. The resolution was to copy over elements from another non-empty file and then change it according to the needs.

Example (packages.config):

<?xml version="1.0" encoding="utf-8"?>
<packages>
 <package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net451"/>
 <package id="Newtonsoft.Json" version="5.0.4" targetFramework="net451"/>
</packages>

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).


Deleting the .user file is exactly what fixed the problem for me. Lightning strike near the office shut my PC down and corrupted my .user file and project wouldn't load. I opened the file in Notepad++ and the "spaces" turned out to be [NULL] characters. Deleted the .user file and the file loaded!

source https://forums.asp.net/t/1491251.aspx?Can+t+load+project+because+root+element+is+missing+


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.


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, 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 Microsoft.Common.CurrentVersion.targets was corrupted. I copied this file from other system and it worked.

참고URL : https://stackoverflow.com/questions/3772486/how-to-fix-root-element-is-missing-when-doing-a-visual-studio-vs-build

반응형