我可以向 nuget 安装添加自定义步骤吗

Can I add a custom step to a nuget install

我正在研究允许许多网站项目从 CSS/JS/HTML 的同一个集合中提取并让该集合更新一次然后交付给使用它的所有项目的方法。

目前,我正在探索使用 NuGet 包(我的公司使用 TFS 和 VS,因此它似乎是合乎逻辑的包管理器)来交付样式,并使用内容文件夹将文件直接交付到项目中.但是,每个项目都需要位于不同位置的这些文件才能正常工作。

有没有办法将自定义脚本添加到每个项目的 NuGet 包的 post-install/update 中?

对于未来的你们:

在您的包裹中:tools/install.ps1

param($installPath, $toolsPath, $package, $project)
$projectFullName = $project.FullName
$debugString = "install.ps1 executing for " + $projectFullName
Write-Host $debugString

$fileInfo = new-object -typename System.IO.FileInfo -ArgumentList $projectFullName
$projectDirectory = $fileInfo.DirectoryName
$customInstallFile = $projectDirectory + "\" + $package.Id + ".ps1"
Write-Host "looking for" $customInstallFile 

if(Test-Path $customInstallFile){
    Write-Host "found it"
    & $customInstallFile
} else {
    Write-Host "not found"
}

Write-Host "Installation Complete"

并且在您项目的根文件夹中:[packageId].ps1

Write-Host "Hello world!"