성태의 닷넷 이야기
홈 주인
모아 놓은 자료
프로그래밍
질문/답변
사용자 관리
사용자
메뉴
아티클
외부 아티클
유용한 코드
온라인 기능
MathJax 입력기
최근 덧글
[정성태] 제가 큰 실수를 했군요. ^^; Delegate를 통한 Bein...
[정성태] Working with Rust Libraries from C#...
[정성태] Detecting blocking calls using asyn...
[정성태] 아쉽게도, 커뮤니티는 아니고 개인 블로그입니다. ^^
[정성태] 질문이 잘 이해가 안 됩니다. 우선, 해당 소스코드에서 ILis...
[양승조
] var대신 dinamic으로 선언해서 해결은 했습니다. 맞는 해...
[양승조
] 또 막혔습니다. ㅠㅠ var list = props[i].Ge...
[양승조
] 아. 감사합니다. 어제는 안됐던것 같은데....정신을 차려야겠네...
[정성태] "props[i].GetValue(props[i])" 코드에서 ...
[정성태] 저렇게 조각 코드 말고, 실제로 재현이 되는 예제 프로젝트를 압...
글쓰기
제목
이름
암호
전자우편
HTML
홈페이지
유형
제니퍼 .NET
닷넷
COM 개체 관련
스크립트
VC++
VS.NET IDE
Windows
Team Foundation Server
디버깅 기술
오류 유형
개발 환경 구성
웹
기타
Linux
Java
DDK
Math
Phone
Graphics
사물인터넷
부모글 보이기/감추기
내용
<div style='display: inline'> <h1 style='font-family: Malgun Gothic, Consolas; font-size: 20pt; color: #006699; text-align: center; font-weight: bold'>dotnet build/restore - error : Root element is missing</h1> <p> 오호~~~ 이게 웬일입니까, 빌드하다가 실로 오랜만에 시스템이 갑자기 BSOD가 뜨더니, 리부트 후 다시 하는 빌드에서 이런 오류가 발생합니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > $ <span style='color: blue; font-weight: bold'>dotnet publish -r linux-x64 -c Release</span> MSBuild version 17.8.3+195e7f5a3 for .NET Determining projects to restore... /usr/share/dotnet/sdk/8.0.100/NuGet.targets(156,5): error : Root element is missing. [/mnt/c/temp/ConsoleApp1/ConsoleApp1.csproj] </pre> <br /> 재미있는 것은, 윈도우 환경에서 "dotnet publish -r win-x64 -c Release"로 실행하면 문제 없이 빌드가 됩니다. ^^;<br /> <br /> <hr style='width: 50%' /><br /> <br /> 자, 그럼 오류가 발생했다고 하는, /usr/share/dotnet/sdk/8.0.100/NuGet.targets 파일의 156 라인을 볼까요?<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > 155 <!-- Call restore --> 156 <<span style='color: blue; font-weight: bold'>RestoreTask</span> 157 RestoreGraphItems="@(_RestoreGraphEntryFiltered)" 158 RestoreDisableParallel="$(RestoreDisableParallel)" 159 RestoreNoCache="$(RestoreNoCache)" 160 RestoreIgnoreFailedSources="$(RestoreIgnoreFailedSources)" 161 RestoreRecursive="$(RestoreRecursive)" 162 RestoreForce="$(RestoreForce)" 163 HideWarningsAndErrors="$(HideWarningsAndErrors)" 164 Interactive="$(NuGetInteractive)" 165 RestoreForceEvaluate="$(RestoreForceEvaluate)" 166 RestorePackagesConfig="$(RestorePackagesConfig)"> 167 <Output TaskParameter="EmbedInBinlog" ItemName="EmbedInBinlog" /> 168 </RestoreTask> </pre> <br /> RestoreTask니까, 그냥 이렇게만 해도 오류가 재현됩니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > $ <span style='color: blue; font-weight: bold'>dotnet restore</span> Determining projects to restore... /usr/share/dotnet/sdk/8.0.100/NuGet.targets(156,5): error : Root element is missing. [/mnt/c/temp/ConsoleApp1/ConsoleApp1.csproj] </pre> <br /> 문제를 좁혀본 결과, 아래의 참조가 없으면 괜찮았습니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>net8.0</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> <PublishAot>true</PublishAot> <InvariantGlobalization>true</InvariantGlobalization> </PropertyGroup> <ItemGroup> <span style='color: blue; font-weight: bold'><PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" /></span> </ItemGroup> </Project> </pre> <br /> 혹시나 싶어 새롭게 프로젝트를 만들고 추가를 했더니,<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > $ cd /tmp/testconsole $ dotnet new console $ <span style='color: blue; font-weight: bold'>dotnet add package Microsoft.VisualStudio.Azure.Containers.Tools.Targets</span> Determining projects to restore... Writing /tmp/tmpnqryAv.tmp info : X.509 certificate chain validation will use the fallback certificate bundle at '/usr/share/dotnet/sdk/8.0.100/trustedroots/codesignctl.pem'. info : X.509 certificate chain validation will use the fallback certificate bundle at '/usr/share/dotnet/sdk/8.0.100/trustedroots/timestampctl.pem'. info : Adding PackageReference for package 'Microsoft.VisualStudio.Azure.Containers.Tools.Targets' into project '/mnt/c/temp/ConsoleApp2/ConsoleApp2.csproj'. info : GET https://api.nuget.org/v3/registration5-gz-semver2/microsoft.visualstudio.azure.containers.tools.targets/index.json info : OK https://api.nuget.org/v3/registration5-gz-semver2/microsoft.visualstudio.azure.containers.tools.targets/index.json 898ms info : Restoring packages for /mnt/c/temp/ConsoleApp2/ConsoleApp2.csproj... info : CACHE https://api.nuget.org/v3/vulnerabilities/index.json info : CACHE https://api.nuget.org/v3/vulnerabilities/vulnerability.base.json info : CACHE https://api.nuget.org/v3/vulnerabilities/vulnerability.update.json <span style='color: blue; font-weight: bold'>error: Root element is missing.</span> </pre> <br /> 역시나 동일한 오류가 발생합니다. ^^;<br /> <br /> <hr style='width: 50%' /><br /> <br /> 반면 다른 패키지 참조는 또 잘 됩니다. <br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > $ <span style='color: blue; font-weight: bold'>dotnet add package CustomMessageLoop</span> ...[생략: 성공 메시지]... </pre> <br /> 그렇다면, 지난번 빌드에서 Microsoft.VisualStudio.Azure.Containers.Tools.Targets 패키지를 구성하는 중 뭔가 불안정한 상태로 있는 순간 블루 스크린이 떴던 것이 아닌가 생각됩니다. 일단, 이거저거 따지기 귀찮아서 모든 Nuget cache를 삭제한 다음,<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > // Managing the global packages, cache, and temp folders // <a target='tab' href='https://learn.microsoft.com/en-us/nuget/consume-packages/managing-the-global-packages-and-cache-folders'>https://learn.microsoft.com/en-us/nuget/consume-packages/managing-the-global-packages-and-cache-folders</a> $ <span style='color: blue; font-weight: bold'>dotnet nuget locals all --list</span> http-cache: /home/testusr/.local/share/NuGet/http-cache global-packages: /home/testusr/.nuget/packages/ temp: /tmp/NuGetScratchtestusr plugins-cache: /home/testusr/.local/share/NuGet/plugin-cache $ <span style='color: blue; font-weight: bold'>dotnet nuget locals all --clear</span> Clearing NuGet HTTP cache: /home/testusr/.local/share/NuGet/http-cache Clearing NuGet global packages folder: /home/testusr/.nuget/packages/ Clearing NuGet Temp cache: /tmp/NuGetScratchtestusr Clearing NuGet plugins cache: /home/testusr/.local/share/NuGet/plugin-cache Local resources cleared. </pre> <br /> 다시 패키지 추가를 시도했더니, 이번에는 잘 되었습니다. (단지, 특정 소스에서 설치 시 시간이 약 10분 정도 넘게 걸린 듯합니다.) 어쩌면 그 패키지만 삭제했어도 되지 않았을까 싶은데 다음번에 재현되면 테스트해 보겠습니다. ^^<br /> </p><br /> <br /><hr /><span style='color: Maroon'>[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]</span> </div>
첨부파일
스팸 방지용 인증 번호
1041
(왼쪽의 숫자를 입력해야 합니다.)