Nuget PackageReference样式包将文件复制到解决方案

Nuget PackageReference样式包将文件复制到解决方案,nuget,Nuget,对于旧的解决方案级别packages.config我有一个init.ps1脚本,它将tools目录中的一些文件复制到解决方案的根目录中: param($installPath, $toolsPath, $package) $rootDir = (Get-Item $installPath).parent.parent.fullname $filesSource = join-path $installPath 'tools' Copy-Item "$filesSource/build.ca

对于旧的解决方案级别
packages.config
我有一个
init.ps1
脚本,它将
tools
目录中的一些文件复制到解决方案的根目录中:

param($installPath, $toolsPath, $package)

$rootDir = (Get-Item $installPath).parent.parent.fullname

$filesSource = join-path $installPath 'tools'

Copy-Item "$filesSource/build.cake" $rootDir -Force
Copy-Item "$filesSource/build.ps1" $rootDir -Force
nuspec只是:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
    <metadata>
        ... the standard properties ...
    </metadata>
    <files>
        <file src="build.cake" target="tools\build.cake" />
        <file src="build.ps1" target="tools\build.ps1" />
        <file src="nuget\init.ps1" target="tools\init.ps1" />
    </files>
</package>

... 标准属性。。。
转到
PackageReference
NuGet 3.0样式,安装路径显示为系统级包区域(c:\users\me\.NuGet\packages)。这意味着脚本的行为不同

该包的目的是将我们的通用构建脚本(使用Cake)内部分发到我们的标准项目结构中。这使我们能够进行常见的更改,并通过整个项目的NuGet更新来使用这些更改

我在网上找不到太多关于如何复制这种行为的信息,只是功能仍在开发中,有不同的方法来解决旧问题

那么首先,这可能吗?第二,如果是,如何进行

从好的方面来看,这可能是编写自定义
dotnet
工具的借口