我会使用包配置文件
建设的路径自己
# Get solution folder
$PathToSolution = "C:\Some\Path\SolutionFolder"
# find all packages under the solution folder
$configs = gci $PathToSolution -Filter packages.config -recurse
# get content of every package config file
$configs.fullname | %{[xml]$packages = Get-Content $_;
$packages.packages.package | foreach{
# Get pacakge attributes
$packageId=$_.id;
$packageVersion=$_.version;
# Build the path from the build attributes
$Path="$PathToSolution\packages\$packageId.$PackageVersion";
Write-output $Path}}
我想补充的唯一事情是包路径的唯一性检查,因为很有可能你使用的是包在一个以上项目