0

I'm investigating ways to allow many website projects to pull from the same collection of CSS/JS/HTML and have that collection be updated once and then delivered to all the projects that use it.

At the moment, I'm exploring using a NuGet package (my company uses TFS and VS so it seems the logical package manager) to deliver the styles, and using the content folder to deliver the files directly into the project. However, each project is going to need those files in different locations in order to work properly.

Is there a way to add a custom script to a post-install/update of a NuGet package for each project?

4

1 回答 1

1

对于未来的你们:

在你的包中: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!"
于 2016-08-19T10:36:05.840 回答