첫째, 특정 .nupkg 파일을 다룰 때 Visual Studio를 전혀 사용하고 싶지 않습니다.
NuGet Package Explorer라는 도구가 있으며 GUI를 사용하여 nupkg 파일을 특정 파일 위치로 내보낼 수 있다는 것을 알고 있지만 명령 줄을 사용하여 약 50 개의 .nupkg 파일을 실행하고 압축을 푸는 MSBuild 작업을 설정하려고합니다.
제 질문은 명령 줄을 통해 .nupkg 파일을 지정된 파일 위치에 압축을 풀 수있는 도구가 있습니까?
답변
설치의 일부로 로컬 호스트를 지정하여 NuGet 명령 줄을 사용할 수도 있습니다. 예를 들어 패키지가 현재 디렉토리에 저장된 경우
nuget install MyPackage -Source %cd% -OutputDirectory packages
대상 디렉토리에 압축을 풉니 다.
답변
NuPKG 파일은 zip 파일 일 뿐이므로 zip 파일을 처리 할 수있는 모든 파일은 nupkg 파일, 즉 7zip을 처리 할 수 있어야합니다.
답변
.zip으로 이름을 바꾼 다음 압축을 풉니 다.
답변
다음과 같은 작업을 수행했습니다.
clear
cd PACKAGE_DIRECTORY
function Expand-ZIPFile($file, $destination)
{
$shell = New-Object -ComObject Shell.Application
$zip = $shell.NameSpace($file)
foreach($item in $zip.items())
{
$shell.Namespace($destination).copyhere($item)
}
}
Dir *.nupkg | rename-item -newname { $_.name -replace ".nupkg",".zip" }
Expand-ZIPFile "Package.1.0.0.zip" “DESTINATION_PATH”
답변
PowerShell 5.1 (PackageManagement 모듈) 사용
Install-Package -Name MyPackage -Source (Get-Location).Path -Destination C:\outputdirectory
답변
이것은 나를 위해 일했습니다.
Rename-Item -Path A_Package.nupkg -NewName A_Package.zip
Expand-Archive -Path A_Package.zip -DestinationPath C:\Reference
답변
