【发布时间】:2019-01-13 14:30:08
【问题描述】:
你能帮帮我吗?如何使用 PowerShell 打开和提取“nupkg”包中的文件。 谢谢。
【问题讨论】:
标签: powershell continuous-integration teamcity
你能帮帮我吗?如何使用 PowerShell 打开和提取“nupkg”包中的文件。 谢谢。
【问题讨论】:
标签: powershell continuous-integration teamcity
你可以使用Expand-Archive(你必须重命名文件,见Can I use PowerShell `Expand-Archive` upon a zip file with no extension)
Rename-Item "Newtonsoft.Json.12.0.1.nupkg" "Newtonsoft.Json.12.0.1.nupkg.zip"
Expand-Archive "Newtonsoft.Json.12.0.1.nupkg.zip"
【讨论】:
Expand-Archive -Path Newtonsoft.json.12.0.1.nupkg -Destination .
我更喜欢使用 nuget cli,因为它还安装了依赖项。您只需要nuget install yourpackage。它真的只是一个 5MB 的可执行文件,你甚至可以在每次需要获取包时下载它:
$nugetUrl = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
Invoke-WebRequest -Uri $nugetUrl -OutFile ".\nuget.exe"
.\nuget.exe install yourpackage
【讨论】: