2016-05-25 12 views
0

いくつかのコンテンツファイルをデプロイするナゲットパッケージを作成しています。nugetインストール時にテキストコンテンツファイルを変更する

私は、バージョン番号とインストールパスを含むように変更したいと思います。

私はthisを見つけましたが、configファイルとソースファイルだけを変更するようです。

私はinstall.ps1スクリプトに気付きましたが、ターゲットプロジェクトとその要素だけを変換することができます。

私はプロジェクトにテキストファイルを追加する場合:コンテンツファイルをコピーした後

You just installed package $packageName version $version in $installPath 

install.ps1スクリプトが実行されて実際に

You just installed package myPackage version 1.0.12.12 in packages/myPackage-1.0.12.12 

答えて

0

にインストール後に形質転換しました。意味

Added file 'myfile.txt' to folder 'mypackage\content'. 
Added file 'mypackage.nupkg' to folder 'mypackage'. 
Successfully installed 'mypackage'. 
Added file 'myfile.txt'. 
Added file 'myfile.txt' to project 'myproject' 
>> PowerShell scripts are being executed from 'tools' (not framework-specific) 
Executing script file 'init.ps1` 

は、あなたがそのスクリプトから何でもあなたの静的ファイルを編集することができます(それらへのアクセス)$projectパラメータ〜から:

param($installPath, $toolsPath, $package, $project) 
$myFile = $project.ProjectItems.Item("myfile.txt") 
$filePath = $myFile.Document.FullName 
$content = Get-Content -Path "$filePath" 

コンテンツファイルがcsprojに付加された後、それが実行しています私はこのスクリプトからパッケージ版を入手する標準的な方法を知らないのですが、それは$installPathパラメータの一部です。

希望すると助かります

関連する問題