我们不会将该packages
文件夹提交到我们的存储库。此外,我们不是在构建时恢复包(因为它会增加构建时间),而是在克隆/签出新存储库时使用以下 PowerShell 模块恢复包:
$rootDir = resolve-path "$PSScriptRoot\.."
$nugetRoot = "$rootDir\.nuget"
$env:path += ";$nugetRoot"
function Restore-Packages() {
$packageSources = @(
"$nugetRoot",
"$rootDir/db",
"$rootDir/src",
"$rootDir/test"
)
$packageSources | dir -r -include "packages.config" | % {
$configPath = $_.FullName
$configName = $configPath.Replace($rootDir.ToString() + "\", "")
write-host "Installing packages for " -n
write-host "$configName" -f "white"
nuget install "$configPath" -solutionDir "$rootDir"
}
}
Export-ModuleMember Restore-Packages
这很好用......但不能随机工作!有时,所有包都正确加载,有时随机 package.config
文件会使 Nuget 崩溃!
没有错误消息打印到控制台(即使-verbosity detailed
打开了 nuget.exe)。但是,我确实发现 EventLog 收到一条错误消息:
Log Name: Application
Source: Application Error
Date: 11/21/2012 9:21:42 AM
Event ID: 1000
Task Category: (100)
Level: Error
Keywords: Classic
User: N/A
Description:
Faulting application name: NuGet.exe, version: 2.1.31022.9038, time stamp: 0x50856393
Faulting module name: clr.dll, version: 4.0.30319.239, time stamp: 0x4e181a6d
Exception code: 0xc0000005
Fault offset: 0x0035612d
Faulting process id: 0x408
Faulting application start time: 0x01cdc7eb24bed690
Faulting application path: D:\path\to\app\.nuget\NuGet.exe
Faulting module path: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Report Id: 63343f50-33de-11e2-b0e1-005056c00008
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Application Error" />
<EventID Qualifiers="0">1000</EventID>
<Level>2</Level>
<Task>100</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2012-11-21T13:21:42.000000000Z" />
<EventRecordID>77009</EventRecordID>
<Channel>Application</Channel>
<Security />
</System>
<EventData>
<Data>NuGet.exe</Data>
<Data>2.1.31022.9038</Data>
<Data>50856393</Data>
<Data>clr.dll</Data>
<Data>4.0.30319.239</Data>
<Data>4e181a6d</Data>
<Data>c0000005</Data>
<Data>0035612d</Data>
<Data>408</Data>
<Data>01cdc7eb24bed690</Data>
<Data>D:\path\to\app\.nuget\NuGet.exe</Data>
<Data>C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll</Data>
<Data>63343f50-33de-11e2-b0e1-005056c00008</Data>
</EventData>
</Event>
因为这会默默地失败,所以其他package.config
s 可能会在一个崩溃后运行,也可能不会运行(它也可能崩溃!)。
我已经多次重新启动计算机并清除了 Nuget 缓存,但无济于事。这是我机器的问题吗?是努格吗?
谢谢!