开发者

Using ProjectItems.item

When working with NuGet, I'm attempting to use a powershell script to change a file to an embedded resource. I'm using a small powershell script recommended on the forums here. However, my script only works when the file isn't in a folder.

param($installPath, $toolsPath, $package, $project)

$item = $project.ProjectItems.Item("Folder\ReleaseNotes.txt")
$item.Properties.Item("BuildAction").Value = [int]3

How can I adjust this line to find a file even if it is in a folder:

$item = $project.ProjectItems.Item("ReleaseNo开发者_开发问答tes.txt")


Well, I found it.

ProjectItems is a comprehensive list that contains both files and folders. In order to access folder/ReleaseNotes.txt you have to go down the nav tree. This is the solution

param($installPath, $toolsPath, $package, $project)
$item = $project.ProjectItems.Item("Folder").ProjectItems.Item("ReleaseNotes.txt")
$item.Properties.Item("BuildAction").Value = [int]3
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜