1
0
Fork 0

ci: vcxproj를 packages.config 형식으로 복귀, BuildMsix가 nuget.exe 자동 처리

증상: VS 2022 Enterprise(GitHub windows-latest)에서 PackageReference 형식
vcxproj 빌드 시 ResolveNuGetPackageAssets가 "Sequence contains no elements"
오류로 실패. native vcxproj + PackageReference + msbuild restore 조합의
알려진 회귀.

해결:
- src/EverythingToJpeg.Shell/EverythingToJpeg.Shell.vcxproj: PackageReference
  제거, packages.config + Microsoft.Windows.ImplementationLibrary.targets
  imports 복귀, EnsureNuGetPackageBuildImports target 복귀.
- src/EverythingToJpeg.Shell/packages.config 재추가.
- packaging/BuildMsix.ps1: nuget.exe 없으면 dist.nuget.org에서 자동 다운로드,
  packages.config 기반 restore를 packages/ 폴더에 수행.
- .gitignore: packages/, tools/ 제외.

이러면 사용자 PC(VS 2026)와 CI(VS 2022) 모두 동일한 흐름으로 빌드.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yun Chan 2026-05-06 23:20:45 +09:00
parent fc73b3c9a7
commit 0e752d76e2
4 changed files with 41 additions and 6 deletions

4
.gitignore vendored
View file

@ -46,3 +46,7 @@ src/EverythingToJpeg.Shell/Everythi*/
# .NET artifacts dir from BuildMsix.ps1 # .NET artifacts dir from BuildMsix.ps1
artifacts/ artifacts/
# NuGet packages restore + nuget.exe cache
packages/
tools/

View file

@ -75,8 +75,25 @@ if ($LASTEXITCODE -ne 0) { throw 'dotnet publish 실패' }
# ---- 2) C++ Shell DLL ---- # ---- 2) C++ Shell DLL ----
Write-Host '' Write-Host ''
Write-Host '[2/5] C++ Shell DLL 빌드' Write-Host '[2/5] C++ Shell DLL 빌드'
& $msbuild $shellProj /t:Restore /p:RestorePackagesConfig=true /p:Configuration=$Configuration /p:Platform=$Platform /v:minimal | Out-Host
if ($LASTEXITCODE -ne 0) { throw 'Shell restore 실패' } # nuget.exe 자동 다운로드 (없으면)
$nuget = Get-Command nuget.exe -ErrorAction SilentlyContinue
if (-not $nuget) {
$nugetExe = Join-Path $repoRoot 'tools\nuget.exe'
if (-not (Test-Path $nugetExe)) {
New-Item -ItemType Directory -Path (Split-Path $nugetExe) -Force | Out-Null
Write-Host ' nuget.exe 다운로드 중…'
Invoke-WebRequest -Uri 'https://dist.nuget.org/win-x86-commandline/latest/nuget.exe' -OutFile $nugetExe
}
$nugetCmd = $nugetExe
} else {
$nugetCmd = $nuget.Source
}
$packagesDir = Join-Path $repoRoot 'packages'
& $nugetCmd restore (Join-Path $repoRoot 'src\EverythingToJpeg.Shell\packages.config') -PackagesDirectory $packagesDir | Out-Host
if ($LASTEXITCODE -ne 0) { throw 'NuGet restore 실패' }
& $msbuild $shellProj /p:Configuration=$Configuration /p:Platform=$Platform /m /v:minimal | Out-Host & $msbuild $shellProj /p:Configuration=$Configuration /p:Platform=$Platform /m /v:minimal | Out-Host
if ($LASTEXITCODE -ne 0) { throw 'Shell build 실패' } if ($LASTEXITCODE -ne 0) { throw 'Shell build 실패' }
$shellDll = Join-Path $repoRoot ("src\EverythingToJpeg.Shell\$Platform\$Configuration\EverythingToJpeg.Shell.dll") $shellDll = Join-Path $repoRoot ("src\EverythingToJpeg.Shell\$Platform\$Configuration\EverythingToJpeg.Shell.dll")

View file

@ -99,12 +99,22 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="packages.config" />
<None Include="Source.def" /> <None Include="Source.def" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Windows.ImplementationLibrary" Version="1.0.260126.7" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.260126.7\build\native\Microsoft.Windows.ImplementationLibrary.targets"
Condition="Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.260126.7\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>WIL NuGet 패키지가 복원되지 않았습니다. nuget restore를 먼저 실행하세요.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.260126.7\build\native\Microsoft.Windows.ImplementationLibrary.targets')"
Text="$(ErrorText)" />
</Target>
</Project> </Project>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.260126.7" targetFramework="native" />
</packages>